Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
cybernop committed Apr 14, 2020
0 parents commit 2113b08
Show file tree
Hide file tree
Showing 107 changed files with 25,732 additions and 0 deletions.
68 changes: 68 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# Created by https://www.gitignore.io/api/go,intellij+iml

### Go ###
# Compiled Object files, Static and Dynamic libs (Shared Objects)
*.o
*.a
*.so

# Folders
_obj
_test

# Architecture specific extensions/prefixes
*.[568vq]
[568vq].out

*.cgo1.go
*.cgo2.c
_cgo_defun.c
_cgo_gotypes.go
_cgo_export.*

_testmain.go

*.exe
*.test
*.prof

# Output of the go coverage tool, specifically when used with LiteIDE
*.out

# external packages folder
vendor/

# IntelliJ
*.iml
*.ipr
*.iws
modules.xml
.idea
.idea_modules
#/out/

# Glide
# glide.lock

## Plugin-specific files:

# JIRA plugin
atlassian-ide-plugin.xml

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties

# Sublime text
*.sublime-*

# VS Code
.vscode
.history

# Coverage
.cover

cmd/generate/generate
113 changes: 113 additions & 0 deletions Compliance.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
# APIKit compliance with the OpenAPIv2 specification

Only functional features are listed. Purely descriptive items (e.g. the info object) are directly copied to the output.

| Section | Feature | Scoped | Implemented | Testcase |
| --- |---|:---:|:---:|:---:|
| Data Types | type: format |
|| integer: int32 | x |
|| integer: int64 | x |
|| number: float | x |
|| number: double | x |
|| string | x |
|| string: byte | x |
|| string: binary | x |
|| boolean | x |
|| string: date | x |
|| string: date-time | x |
|| string: password | x |
| Schemes || x
|| http / https | x
|| ws / wss | -
| Client: Consumes | (request to server) |
|| application/json | x
|| application/hal+json | x
|| application/x-www-form-urlencoded | x
|| multipart/form-data | x
| Client: Produces | (response from server) |
|| application/json | x
|| application/hal+json | x
|| application\/xml | x
|| file types as stream | x
| Server: Consumes | (request from client) |
|| application/json | x
|| application/x-www-form-urlencoded | x
|| multipart/form-data | x
| Server: Produces | (response to client) |
|| application/json | x
|| application/hal+json | x
|| file types as stream | x
| Definitions | (see Schema) | x
| Paths || x
|| $ref | x
|| GET, PUT, POST, DELETE, OPTIONS, HEAD, PATCH | x
|| Parameters (see Parameter) | x
| Operations || x
|| Individual Consumes | x
|| Individual Produces | x
|| Parameters (see Parameter) | x
|| Responses (see Response) | x
|| Schemes | -
|| Security (see Security Definitions) | x
| Parameters || x
|| in Path (all types) | x
|| in Query | x
|| in Header | x
|| Body | x
|| Required attribute | x
|| Allow empty value | x
| Parameters and Items || x
|| $ref | x
|| CSV array | x
|| SSV array | -
|| TSV array | -
|| Pipes array | -
|| Multi array (in Form and Query) | ?
|| Maps | x
|| Default values | x
|| Maximum | x
|| Exclusive maximum | x
|| Minimum | x
|| Exclusive minimum | x
|| Maximimum length | x
|| Minimum length | x
|| Pattern | x
|| Maximium items | x
|| Minimum items | x
|| Unique items | x
|| Enums | x
|| Multiple of | x
| Global parameter definitions | | x
| Response || x
|| $ref | x
|| Schema (see Schema) | x
|| Headers | ?
| Schema || x
|| $ref | x
|| All data types and formats | x
|| Default value | x
|| Maximum | x
|| Exclusive maximum | x
|| Minimum | x
|| Exclusive minimum | x
|| Maximimum length | x
|| Minimum length | x
|| Pattern | x
|| Maximium items | x
|| Minimum items | x
|| Unique items | x
|| Enums | x
|| Multiple of | -
|| All of | -
|| Maximimum properties | -
|| Minimum properties | -
|| Properties | -
|| Additional properties | -
|| Discriminator | -
|| Read only | -
| Global response definitions | | x
| Security Definitions ||
|| Basic Auth | x
|| Api Key | x
|| OAuth 2 | -
| Global security definitions || x
34 changes: 34 additions & 0 deletions Contribution.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Contribution Guidelines
## I have found a bug!
Please search the issue tracker if somebody else already filed a ticket for the problem. If yes, please amend your information to the ticket. Otherwise, create a new one with the following information.

- the used version, tag, branch or commit of the APIKit
- the content of the used OpenAPIv2 definition (YAML or JSON)
- a description of the error (with logs or terminal output)
- a description of the expected behaviour

We will process the bug ticket as soon as possible.

## What do I need to know to help?
If you are looking to help to with a code contribution our project using Golang please first have a look at the technologies we used to build the APIKit.

- [APIKit documentation](/README.md)
- [OpenAPIv2 specification](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md)
- [Jennifer code generator](https://github.com/dave/jennifer)

## How do I make a contribution?
Find an issue that you are interested in addressing or a feature that you would like to add.
Fork the repository associated with the issue to your local GitHub organization. This means that you will have a copy of the repository under `your-GitHub-username/repository-name`.

Clone the repository to your local machine using `git clone https://github.com/<your-GitHub-username/repository-name>`. Create a new branch for your fix using `git checkout -b <branch-name>`. Make the appropriate changes for the issue you are trying to address or the feature that you want to add.

Use `git add <paths-of-changed-files>` to add the file contents of the changed files to the "snapshot" git uses to manage the state of the project, also known as the index. Use `git commit -m "insert a short message of the changes made here"` to store the contents of the index with a descriptive message.

Push the changes to the remote repository using `git push origin <branch-name>`.
Submit a pull request to the upstream repository. Title the pull request with a short description of the changes made and the issue or bug number associated with your change. For example, you can title an issue like so "Added more log outputting to resolve #4352".
In the description of the pull request, explain the changes that you made, any issues you think exist with the pull request you made, and any questions you have for the maintainer. It's OK if your pull request is not perfect (no pull request is), the reviewer will be able to help you fix any problems and improve it!

Wait for the pull request to be reviewed by a maintainer. Make changes to the pull request if the reviewing maintainer recommends them. Celebrate your success after your pull request is merged!

## Where can I go for help?
If you need help, you can ask questions via E-Mail: [email protected].
27 changes: 27 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
Copyright (c) 2020 Experience One AG. All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:

* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following disclaimer
in the documentation and/or other materials provided with the
distribution.
* Neither the name of Experience One AG nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
48 changes: 48 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
.PHONY: all
all: test install ## build APIKit and run tests

ALL_PACKAGES=$(shell go list ./... | grep -v "vendor")
GOPATH = $(shell printenv GOPATH)
ifeq ($(GOPATH), )
GOPATH = ~/go
endif

.PHONY: framework
framework: ## build framework components
scripts/version.sh
go install -v ./cmd/fpacker
$(GOPATH)/bin/fpacker -src ./internal/framework/ -dest ./framework/framework_code.go
$(GOPATH)/bin/fpacker -src ./internal/framework/ -dest ./framework/framework_code_client.go -exclude=xserver,validation,middleware,unmarshal -kind=client
$(GOPATH)/bin/fpacker -src ./internal/framework/ -dest ./framework/framework_code_server.go -exclude=xclient,roundtripper,hooks -kind=server

testgenerator: framework
go build ./cmd/apikit
mv ./apikit $(GOPATH)/bin/test_apikit
git checkout @ -- ./internal/framework/version/version.go
git checkout @ -- ./framework/framework_code.go
git checkout @ -- ./framework/framework_code_client.go
git checkout @ -- ./framework/framework_code_server.go

.PHONY: test
test: testgenerator ## run tests
$(GOPATH)/bin/test_apikit --debug generate ./tests/data/swagger.yaml ./tests/api/ api
$(GOPATH)/bin/test_apikit --debug generate --mocked ./tests/data/swagger.yaml ./tests/mock/ api
for package in $(ALL_PACKAGES); do ENVIRONMENT=test go test $$package; if [ $$? -ne "0" ]; then echo "Test failed!"; exit 1; fi; done

.PHONY: lint
lint: ## runs linters for all packages except 'gen' (requires golangci-lint)
golangci-lint run --skip-dirs '(example|tests)'

.PHONY: install
install: framework ## builds and installs the binaries of the APIKit in $GOPATH/bin
scripts/version.sh
cd ./cmd/apikit && \
go build -o apikit
mv ./cmd/apikit/apikit $(GOPATH)/bin/apikit
git checkout @ -- ./internal/framework/version/version.go

.PHONY: help
help: ## prints help for most of the make targets
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'

.DEFAULT_GOAL := help
Loading

0 comments on commit 2113b08

Please sign in to comment.