-
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.
feat: generate go server and ts client
use openapi generator to start building the api
- Loading branch information
1 parent
c8c9ff5
commit dc38093
Showing
42 changed files
with
2,401 additions
and
297 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,24 @@ | ||
name: Build | ||
on: | ||
push: | ||
|
||
jobs: | ||
test: | ||
name: test | ||
runs-on: ubuntu-latest | ||
container: golang:1.14-alpine | ||
env: | ||
CGO_ENABLED: 0 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Test | ||
run: | | ||
go mod download | ||
mkdir coverage | ||
go test -v ./internal/... -cover -coverprofile=coverage/info.cov | ||
- name: Coveralls | ||
uses: shogo82148/actions-goveralls@v1 | ||
with: | ||
path-to-profile: .coverage/info.cov |
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 @@ | ||
# OpenAPI Generator Ignore | ||
|
||
main.go | ||
|
||
Dockerfile |
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.0.0-SNAPSHOT |
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 @@ | ||
{ | ||
"sourceFolder": "internal", | ||
"packageName": "opendam", | ||
"featureCORS": true | ||
} |
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,19 +1,30 @@ | ||
.PHONY: build test | ||
|
||
gen: | ||
docker run -v ${PWD}:/open-dam openapitools/openapi-generator-cli generate -i /open-dam/api/openapi.yaml -g go-server -o /open-dam -c /open-dam/config.json --git-user-id open-dam --git-repo-id open-dam-api --enable-post-process-file -t /open-dam/.openapi-generator/templates/go-server | ||
# GO_POST_PROCESS_FILE="gofmt -w" | ||
docker run -v ${PWD}:/open-dam openapitools/openapi-generator-cli generate -i /open-dam/api/openapi.yaml -g go-server -o /open-dam -c /open-dam/.openapi-generator/config.json --git-user-id open-dam --git-repo-id open-dam-api | ||
# -e GO_POST_PROCESS_FILE="gofmt -w" | ||
# -t /open-dam/.openapi-generator/templates/go-server | ||
|
||
|
||
docker run -v ${PWD}:/open-dam openapitools/openapi-generator-cli generate -i /open-dam/api/openapi.yaml -g typescript-node -o /open-dam/client/ts/ --git-user-id open-dam --git-repo-id open-dam-api --additional-properties=npmName=@open-dam/open-dam-api,npmVersion=1.0.0 | ||
|
||
gen-docs: | ||
# Requrires [Redoc](https://github.com/Redocly/redoc) | ||
# `npm install redoc-cli -g --save` | ||
redoc-cli bundle api/spec.yaml -o docs/index.html --options.disableSearch --options.hideDownloadButton | ||
redoc-cli bundle api/openapi.yaml -o docs/index.html --options.disableSearch --options.hideDownloadButton | ||
|
||
build: | ||
go build -o bin/open-dam-api | ||
go build -o ./bin/open-dam-api ./cmd/open-dam-api/ | ||
|
||
build-docker: | ||
docker build -t open-dam-api . | ||
docker build -t open-dam-api -f build/Dockerfile . | ||
|
||
test: | ||
go test -v ./internal/... | ||
|
||
test-coverage: | ||
if [ ! -d coverage ]; then mkdir coverage; fi | ||
go test -coverpkg ./internal/... -coverprofile coverage/coverage.out ./... && go tool cover -html=coverage/coverage.out | ||
|
||
run: | ||
docker run -p 8080:8080 open-dam-api |
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,2 +1,36 @@ | ||
# Open DAM API | ||
The API for an pen source digital asset manager called Open DAM. Built to help teams and individuals manage, search, and retrieve digital assets. | ||
# Go API Server for opendam | ||
|
||
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) | ||
|
||
## Overview | ||
This server was generated by the [openapi-generator] | ||
(https://openapi-generator.tech) project. | ||
By using the [OpenAPI-Spec](https://github.com/OAI/OpenAPI-Specification) from a remote server, you can easily generate a server stub. | ||
- | ||
|
||
To see how to make this your own, look here: | ||
|
||
[README](https://openapi-generator.tech) | ||
|
||
- API version: 0.0.0 | ||
- Build date: 2020-05-18T05:57:30.028Z[GMT] | ||
|
||
|
||
### Running the server | ||
To run the server, follow these simple steps: | ||
|
||
``` | ||
go run main.go | ||
``` | ||
|
||
To run the server in a docker container | ||
``` | ||
docker build --network=host -t opendam . | ||
``` | ||
|
||
Once image is built use | ||
``` | ||
docker run --rm -it opendam | ||
``` | ||
|
||
|
Oops, something went wrong.