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

Add waydowntown OpenAPI servers #48

Open
wants to merge 16 commits into
base: main
Choose a base branch
from
Open
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
223 changes: 223 additions & 0 deletions waydowntown/openapi.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,223 @@
openapi: 3.0.0
info:
title: Games API
version: 1.0.0
paths:
/games:
post:
summary: Create a new game
parameters:
- in: query
name: concept
schema:
type: string
required: false
description: Optional concept for the game
- in: query
name: incarnation_filter[concept]
schema:
type: string
required: false
description: Filter incarnations by concept
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/GameInput"
responses:
"201":
description: Successfully created game
content:
application/json:
schema:
type: object
properties:
data:
$ref: "#/components/schemas/Game"
included:
type: array
items:
oneOf:
- $ref: "#/components/schemas/Incarnation"
- $ref: "#/components/schemas/Region"
/games/{id}:
get:
summary: Fetch a game
parameters:
- in: path
name: id
required: true
schema:
type: string
format: uuid
responses:
"200":
description: Successfully fetched game
content:
application/json:
schema:
type: object
properties:
data:
$ref: "#/components/schemas/Game"
included:
type: array
items:
oneOf:
- $ref: "#/components/schemas/Incarnation"
- $ref: "#/components/schemas/Region"
- $ref: "#/components/schemas/Answer"
/answers:
post:
summary: Create a new answer
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/AnswerInput"
responses:
"201":
description: Successfully created answer
content:
application/json:
schema:
$ref: "#/components/schemas/Answer"
components:
schemas:
GameInput:
type: object
properties:
incarnation_id:
type: string
format: uuid
Game:
type: object
properties:
id:
type: string
format: uuid
attributes:
type: object
properties:
complete:
type: boolean
relationships:
type: object
properties:
incarnation:
type: object
properties:
data:
type: object
properties:
id:
type: string
format: uuid
winner_answer:
type: object
properties:
data:
type: object
nullable: true
properties:
id:
type: string
format: uuid
Incarnation:
type: object
properties:
id:
type: string
format: uuid
attributes:
type: object
properties:
concept:
type: string
mask:
type: string
answer:
type: string
answers:
type: array
items:
type: string
relationships:
type: object
properties:
region:
type: object
properties:
data:
type: object
properties:
id:
type: string
format: uuid
Region:
type: object
properties:
id:
type: string
format: uuid
attributes:
type: object
properties:
name:
type: string
description:
type: string
relationships:
type: object
properties:
parent:
type: object
properties:
data:
type: object
nullable: true
properties:
id:
type: string
format: uuid
AnswerInput:
type: object
properties:
answer:
type: string
game:
type: object
properties:
data:
type: object
properties:
id:
type: string
format: uuid
Answer:
type: object
properties:
id:
type: string
format: uuid
attributes:
type: object
properties:
answer:
type: string
correct:
type: boolean
relationships:
type: object
properties:
game:
type: object
properties:
data:
type: object
properties:
id:
type: string
format: uuid
2 changes: 2 additions & 0 deletions waydowntown/waydowntown-server-axum/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
target
Cargo.lock
23 changes: 23 additions & 0 deletions waydowntown/waydowntown-server-axum/.openapi-generator-ignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# OpenAPI Generator Ignore
# Generated by openapi-generator https://github.com/openapitools/openapi-generator

# Use this file to prevent files from being overwritten by the generator.
# The patterns follow closely to .gitignore or .dockerignore.

# As an example, the C# client generator defines ApiClient.cs.
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
#ApiClient.cs

# You can match any string of characters against a directory, file or extension with a single asterisk (*):
#foo/*/qux
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux

# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
#foo/**/qux
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux

# You can also negate patterns with an exclamation (!).
# For example, you can ignore all files in a docs folder with the file extension .md:
#docs/*.md
# Then explicitly reverse the ignore rule for a single file:
#!docs/README.md
10 changes: 10 additions & 0 deletions waydowntown/waydowntown-server-axum/.openapi-generator/FILES
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.gitignore
Cargo.toml
README.md
src/apis/default.rs
src/apis/mod.rs
src/header.rs
src/lib.rs
src/models.rs
src/server/mod.rs
src/types.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
7.7.0
53 changes: 53 additions & 0 deletions waydowntown/waydowntown-server-axum/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
[package]
name = "waydowntown-server"
version = "1.0.0"
authors = ["OpenAPI Generator team and contributors"]
description = "No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)"
edition = "2021"

[features]
default = ["server"]
server = []
conversion = [
"frunk",
"frunk_derives",
"frunk_core",
"frunk-enum-core",
"frunk-enum-derive",
]

[dependencies]
async-trait = "0.1"
axum = { version = "0.7" }
axum-extra = { version = "0.9", features = ["cookie", "multipart"] }
base64 = "0.22"
bytes = "1"
chrono = { version = "0.4", features = ["serde"] }
frunk = { version = "0.4", optional = true }
frunk-enum-core = { version = "0.3", optional = true }
frunk-enum-derive = { version = "0.3", optional = true }
frunk_core = { version = "0.4", optional = true }
frunk_derives = { version = "0.4", optional = true }
http = "1"
lazy_static = "1"
regex = "1"
serde = { version = "1", features = ["derive"] }
serde_json = { version = "1", features = ["raw_value"] }
serde_urlencoded = "0.7"
sqlx = { version = "0.7", features = [
"runtime-tokio-rustls",
"postgres",
"uuid",
"chrono",
] }
tokio = { version = "1", default-features = false, features = [
"signal",
"rt-multi-thread",
] }
tracing = { version = "0.1", features = ["attributes"] }
tracing-subscriber = "0.3"
uuid = { version = "1", features = ["serde"] }
validator = { version = "0.18", features = ["derive"] }

[dev-dependencies]
tracing-subscriber = "0.3"
Loading