Implement rough architecture
This commit is contained in:
104
api/dash_api.yaml
Normal file
104
api/dash_api.yaml
Normal file
@ -0,0 +1,104 @@
|
||||
openapi: '3.0.2'
|
||||
info:
|
||||
title: Dash API
|
||||
version: '0.1'
|
||||
servers:
|
||||
- url: http://localhost:18010/api/v1
|
||||
- url: http://localhost:8080/api/v1
|
||||
- url: https://dash.pander.me/api/v1
|
||||
paths:
|
||||
/journal/entry/{date}:
|
||||
get:
|
||||
operationId: getJournalEntryForDate
|
||||
responses:
|
||||
'200':
|
||||
description: A journal entry for a specific day.
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/JournalEntry'
|
||||
parameters:
|
||||
- name: date
|
||||
in: path
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
format: date
|
||||
example: 2022-02-18
|
||||
post:
|
||||
operationId: writeJournalEntryForDate
|
||||
requestBody:
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/JournalEntry'
|
||||
responses:
|
||||
'200':
|
||||
description: Journal entry successfully written.
|
||||
parameters:
|
||||
- name: date
|
||||
in: path
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
format: date
|
||||
example: 2022-02-18
|
||||
delete:
|
||||
operationId: deleteJournalEntryForDate
|
||||
responses:
|
||||
'200':
|
||||
description: Journal entry successfully deleted.
|
||||
parameters:
|
||||
- name: date
|
||||
in: path
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
format: date
|
||||
example: 2022-02-18
|
||||
components:
|
||||
schemas:
|
||||
JournalEntry:
|
||||
type: object
|
||||
required:
|
||||
- date
|
||||
properties:
|
||||
date:
|
||||
type: string
|
||||
format: date
|
||||
example: 2022-02-18
|
||||
thankful:
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
example:
|
||||
- "thankful 1"
|
||||
- "thankful 2"
|
||||
- "thankful 3"
|
||||
looking_forward:
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
example:
|
||||
- "looking forward 1"
|
||||
- "looking forward 2"
|
||||
- "looking forward 3"
|
||||
been_great:
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
example:
|
||||
- "been great 1"
|
||||
- "been great 2"
|
||||
- "been great 3"
|
||||
do_better:
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
example:
|
||||
- "do better 1"
|
||||
- "do better 2"
|
||||
- "do better 3"
|
||||
journal:
|
||||
type: string
|
||||
example: "journal entry 1"
|
||||
19
api/generate_go_server.sh
Executable file
19
api/generate_go_server.sh
Executable file
@ -0,0 +1,19 @@
|
||||
#!/bin/bash
|
||||
shopt -s extglob
|
||||
|
||||
docker run --rm -v "${PWD}:/local" openapitools/openapi-generator-cli generate \
|
||||
-i /local/dash_api.yaml \
|
||||
--git-host=github.com \
|
||||
--git-user-id=moustachioed \
|
||||
--git-repo-id=dash \
|
||||
--api-package dashapi \
|
||||
--artifact-id dashapi \
|
||||
--invoker-package dashapi \
|
||||
--package-name dashapi \
|
||||
-g go-server \
|
||||
-p packageName=dashapi,featureCORS=true,outputAsLibrary=true,sourceFolder=dashapi \
|
||||
-o /local/api_server
|
||||
# -p packageName=dashapi,featureCORS=true,outputAsLibrary=true \
|
||||
|
||||
rm -rf ../backend/dashapi
|
||||
cp -r ./api_server/dashapi ../backend/
|
||||
Reference in New Issue
Block a user