Skip to content

Commit

Permalink
Create basic app
Browse files Browse the repository at this point in the history
  • Loading branch information
MikailBag committed May 18, 2020
1 parent a08f696 commit c47a4f0
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 36 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@ cmake-build-*
/vm-sysroot/sysroot
/vm-sysroot/sysroot/*
/vm-sysroot/image/hdd.img
/vm-sysroot/typescript
/vm-sysroot/typescript
/venv
/src/apiserver/__pycache__
3 changes: 3 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
fastapi == 0.54.2
pydantic == 1.5.1
uvicorn == 0.11.5
34 changes: 34 additions & 0 deletions src/apiserver/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import fastapi
from pydantic import BaseModel

app = fastapi.FastAPI()

@app.get('/system/is-dev', response_model = bool, operation_id = "isDev")
def route_is_dev():
"""
Returns if JJS is running in development mode.
Please note that you don't have to respect this information, but following is recommended:
1. Display it in each page/view.
2. Change theme.
3. On login view, add button "login as root".
"""
return True

class ApiVersion(BaseModel):
major: int
minor: int

@app.get('/system/api-version', response_model = ApiVersion, operation_id = "apiVersion")
def route_api_version():
"""
Returns API version
Version is returned in format {major: MAJOR, minor: MINOR}.
MAJOR component is incremented, when backwards-incompatible changes were made.
MINOR component is incremented, when backwards-compatible changes were made.
It means, that if you tested application with apiVersion == X.Y, your application
should assert that MAJOR = X and MINOR >= Y
"""
return ApiVersion(major=0, minor=0)
35 changes: 0 additions & 35 deletions src/apiserver_old/engine/docs/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,41 +4,6 @@ info:
version: ""

paths:
"/system/api-version":
get:
operationId: apiVersion
summary: Returns API version
description: |-
Version is returned in format {major: MAJOR, minor: MINOR}.
MAJOR component is incremented, when backwards-incompatible changes were made.
MINOR component is incremented, when backwards-compatible changes were made.
It means, that if you developed application with apiVersion X.Y, your application
should assert that MAJOR = X and MINOR >= Y
responses:
200:
description: ok
content:
application/json:
schema:
$ref: "#/components/schemas/ApiVersion"
"/system/is-dev":
get:
operationId: isDev
summary: Returns if JJS is running in development mode.
description: |-
Please note that you don't have to respect this information, but following is recommended:
- Display it in each page/view.
- Change theme.
- On login view, add button "login as root".
responses:
200:
description: ok
content:
application/json:
schema:
type: boolean
"/contests/{name}":
get:
operationId: getContest
Expand Down

0 comments on commit c47a4f0

Please sign in to comment.