-
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.
- Loading branch information
Showing
44 changed files
with
3,543 additions
and
0 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,36 @@ | ||
name: "Build and Test" | ||
on: | ||
push: | ||
branches: | ||
pull_request: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
package: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
- name: Install Go | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version: 1.19 | ||
cache: true | ||
- name: Get Wails dependencies | ||
run: sudo apt update && sudo apt install -y libgtk-3-dev libwebkit2gtk-4.0-dev | ||
- name: Get Wails | ||
run: go install github.com/wailsapp/wails/v2/cmd/wails@latest | ||
- name: Wails doctor | ||
run: wails doctor | ||
- name: Build package linux | ||
run: | | ||
export PATH=$PATH:$(go env GOPATH)/bin | ||
echo ${{ env.GITHUB_REF }} | ||
echo ${{ env.GITHUB_HEAD_REF }} | ||
mkdir -p ~/.wails | ||
cp wails.json ~/.wails/ | ||
export LOG_LEVEL=debug | ||
export GODEBUG=1 | ||
wails build -noPackage | ||
- name: Testing | ||
run: go test . |
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,123 @@ | ||
name: "Build and create Release" | ||
on: | ||
push: | ||
tags: | ||
- v** | ||
workflow_dispatch: | ||
|
||
jobs: | ||
package: | ||
strategy: | ||
matrix: | ||
go-version: [1.19] | ||
os: [ubuntu-latest, macos-latest, windows-latest] | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
- name: Install Go | ||
uses: actions/setup-go@v3 | ||
with: | ||
cache: true | ||
go-version: ${{ matrix.go-version }} | ||
- name: Set Version | ||
run: echo "VERSION=$(git rev-parse --short HEAD)" >> $GITHUB_ENV | ||
- name: Get Wails dependencies | ||
run: sudo apt update && sudo apt install -y libgtk-3-dev libwebkit2gtk-4.0-dev | ||
if: matrix.os == 'ubuntu-latest' | ||
- name: Get Wails | ||
run: go install github.com/wailsapp/wails/v2/cmd/wails@latest | ||
- name: Wails doctor | ||
run: wails doctor | ||
- name: Build package macOS | ||
run: | | ||
export PATH=${PATH}:`go env GOPATH`/bin | ||
echo "building on ${{ matrix.os }}" | ||
mkdir -p ~/.wails | ||
cp wails.json ~/.wails/ | ||
export LOG_LEVEL=debug | ||
export GODEBUG=1 | ||
wails build | ||
echo "converting .app into a .dmg" | ||
npm install -g appdmg | ||
cp ./build/darwin/dmg-spec.json ./build/bin/dmg-spec.json | ||
cd ./build/bin/ | ||
appdmg dmg-spec.json apivalidator.dmg | ||
zip apivalidator.zip apivalidator.dmg | ||
if: matrix.os == 'macos-latest' | ||
- name: Build package linux | ||
run: | | ||
export PATH=$PATH:$(go env GOPATH)/bin | ||
echo "building on ${{ matrix.os }}" | ||
mkdir -p ~/.wails | ||
cp wails.json ~/.wails/ | ||
export LOG_LEVEL=debug | ||
export GODEBUG=1 | ||
wails build | ||
tar -czvf apivalidator.tar.gz ./build/bin/ApiValidator | ||
if: matrix.os == 'ubuntu-latest' | ||
- name: Build package windows | ||
run: | | ||
$GP = (go env GOPATH) | ||
$env:path = "$env:path;$GP\bin" | ||
echo "building on ${{ matrix.os }}" | ||
New-Item -ItemType directory -Path "$HOME\.wails" -Force | ||
Copy-Item -Path "$PWD\wails.json" -Destination "$HOME\.wails\wails.json" | ||
choco install mingw | ||
wails build | ||
Compress-Archive -Path .\build\bin\ApiValidator* -DestinationPath .\apivalidator.zip | ||
if: matrix.os == 'windows-latest' | ||
- name: upload artifact macOS | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: apivalidator-macOS | ||
path: ./build/bin/apivalidator.zip | ||
if: matrix.os == 'macos-latest' | ||
- name: upload artifact linux | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: apivalidator-linux | ||
path: apivalidator.tar.gz | ||
if: matrix.os == 'ubuntu-latest' | ||
- name: upload artifact windows | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: apivalidator-windows | ||
path: apivalidator.zip | ||
if: matrix.os == 'windows-latest' | ||
|
||
release: | ||
runs-on: ubuntu-latest | ||
needs: package | ||
steps: | ||
- name: Download linux package | ||
uses: actions/download-artifact@v1 | ||
with: | ||
name: apivalidator-linux | ||
- name: Download windows package | ||
uses: actions/download-artifact@v1 | ||
with: | ||
name: apivalidator-windows | ||
- name: Download macOS package | ||
uses: actions/download-artifact@v1 | ||
with: | ||
name: apivalidator-macOS | ||
- name: Rename Files | ||
run: | | ||
mv ./apivalidator-linux/apivalidator.tar.gz ./apivalidator-linux/apivalidator_${{ github.ref_name }}_linux_x86_64.tar.gz | ||
mv ./apivalidator-macOS/apivalidator.zip ./apivalidator-macOS/apivalidator_${{ github.ref_name }}_macOS.zip | ||
mv ./apivalidator-windows/apivalidator.zip ./apivalidator-windows/apivalidator_${{ github.ref_name }}_windows.zip | ||
- name: Create Release | ||
id: create_release | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
tag_name: ${{ github.ref_name }} | ||
name: ${{ github.ref_name }} | ||
draft: true | ||
prerelease: true | ||
generate_release_notes: true | ||
files: | | ||
./apivalidator-linux/apivalidator_${{ github.ref_name }}_linux_x86_64.tar.gz | ||
./apivalidator-macOS/apivalidator_${{ github.ref_name }}_macOS.zip | ||
./apivalidator-windows/apivalidator_${{ github.ref_name }}_windows.zip |
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,23 @@ | ||
# Binaries for programs and plugins | ||
*.exe | ||
*.exe~ | ||
*.dll | ||
*.so | ||
*.dylib | ||
|
||
# Test binary, built with `go test -c` | ||
*.test | ||
|
||
# Output of the go coverage tool, specifically when used with LiteIDE | ||
*.out | ||
|
||
# Dependency directories (remove the comment below to include it) | ||
# vendor/ | ||
|
||
# wails | ||
build/bin | ||
node_modules | ||
frontend/dist | ||
|
||
/.idea/ | ||
/.fleet/ |
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,25 @@ | ||
BSD 2-Clause License | ||
|
||
Copyright (c) 2022, Florian Schlund | ||
All rights reserved. | ||
|
||
Redistribution and use in source and binary forms, with or without | ||
modification, are permitted provided that the following conditions are met: | ||
|
||
1. Redistributions of source code must retain the above copyright notice, this | ||
list of conditions and the following disclaimer. | ||
|
||
2. 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. | ||
|
||
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 HOLDER 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. |
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,47 @@ | ||
# apivalidator | ||
Simple Go app with Wails and Vue.js to test Swagger/OpenAPI Request against API specification. | ||
|
||
## About | ||
|
||
Ever wondered if your request to a API passes all the schema validations through sometimes multiple gateways and differing constrains? | ||
Afraid of hitting a rate limit while trying to figure out how your requests should look like? | ||
|
||
Well this is the tool for you. Just paste a valid OpenApi or Swagger definition on the left, your request on the right, select the corresponding path and operation and hit the _validate_ button. | ||
|
||
If your request wouldn't match, e. g. because a string is too long or a number outside the allowed range, you'll see the reason why. | ||
|
||
## Usage | ||
|
||
### Installation | ||
|
||
Either head to the releases and download the executable for your system or | ||
use the sourcecode directly. | ||
|
||
__Neither the MacOS nor the Windows Version are signed! You'll get a warning when starting the app. | ||
Proceed at your own risk!__ | ||
Running from source won't throw a warning at you. | ||
|
||
### Requirements for running from source | ||
|
||
You'll need Go and Wails to get the app running from source: | ||
|
||
* Go -> [Install Go](https://go.dev/doc/install) | ||
* Wails (also needs NPM) -> [Install Wails](https://wails.io/docs/gettingstarted/installation) | ||
|
||
After you've installed Go and Wails, just clone this repo and execute `wails dev` | ||
|
||
## Basic Usage | ||
|
||
Once you've stared the app you'll see a window with four fields: | ||
![Usage](./assets/usage.png) | ||
|
||
1. Post your API schema here | ||
2. Post your request payload here | ||
3. Hit 'Load Paths', select the path and operation you want to use and push 'validate' | ||
4. If there are any errors in your request, they are displayed here | ||
In this example the allowed range for 'id' is from 1 to 50 but we tried 100 | ||
|
||
### Limitations | ||
|
||
* Swagger V2.x and OpenAPI V3.x is supported | ||
* only payload validation is available |
Oops, something went wrong.