From fdc6ec96d74f4698c6f2d4eda64b3d731cb57c78 Mon Sep 17 00:00:00 2001 From: Filip Bucek Date: Mon, 30 Sep 2019 17:23:11 +0200 Subject: [PATCH] Adding snowboard Blueprint API tool --- README.md | 12 ++++++++ colnod.apib | 63 +++++++++++++++++++++++++++++++++++++++++ openapi-testserver.yaml | 18 ++++++++---- snowboard.yml | 30 ++++++++++++++++++++ 4 files changed, 117 insertions(+), 6 deletions(-) create mode 100644 colnod.apib create mode 100644 snowboard.yml diff --git a/README.md b/README.md index ca64db4..5f6c816 100644 --- a/README.md +++ b/README.md @@ -32,3 +32,15 @@ curl -k --user "spaceti:E7FEA07DBC82FB9BA34B2E453E2EFE89F0583E7187543507EF11E847 ```bash curl -k --user "spaceti:E7FEA07DBC82FB9BA34B2E453E2EFE89F0583E7187543507EF11E84726071FE428445372F2E46B455EB0C79747C51E362F403CE39473A2A8C2DFA0CE5C9826C0" -d '{"password":"E7FEA07DBC82FB9BA34B2E453E2EFE89F0583E7187543507EF11E84726071FE428445372F2E46B455EB0C79747C51E362F403CE39473A2A8C2DFA0CE5C9826C0","username":"spaceti"}' -H "Content-Type: application/json" https://192.168.254.11:8443/AaaManager/authSession ``` + +## Testing Blueprint API + +### Snowboard + +`snowboard http -c snowboard.yml --playground colnod.apib` + +[Colnod API snowboard documentation](http://localhost:8088) + +#### Install snowboard + +`npm install -g snowboard` diff --git a/colnod.apib b/colnod.apib new file mode 100644 index 0000000..e818665 --- /dev/null +++ b/colnod.apib @@ -0,0 +1,63 @@ +FORMAT: 1A + +# JSON Schema +Every request and response can have a schema. Below you will find examples +using [JSON Schema](http://json-schema.org/) to describe the format of request +and response body content. + + +# Notes [/AaaManager/authSession] + ++ Body + + + username: spaceti (required) - User identifier + + password: E7FEA07DBC82FB9BA34B2E453E2EFE89F0583E7187543507EF11E84726071FE428445372F2E46B455EB0C79747C51E362F403CE39473A2A8C2DFA0CE5C9826C0 (required) - sha512 password + +## Get a note [POST] +Gets a single note by its unique identifier. + ++ Request (application/json) + + + Body + + { + "user": "String", + "password": "String ", + } + + + Schema + + { + "type": "object", + "properties": { + "username": { + "type": "string" + }, + "password": { + "type": "string" + }, + } + } + ++ Response 200 (application/json) + + + Body + + { + "id": "String", + "token": "String ", + } + + + Schema + + { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "token": { + "type": "string" + }, + } + } \ No newline at end of file diff --git a/openapi-testserver.yaml b/openapi-testserver.yaml index c62d493..512fcdb 100644 --- a/openapi-testserver.yaml +++ b/openapi-testserver.yaml @@ -12,7 +12,7 @@ Jira issues: email: filip.bucek@spaceti.com servers: - - url: http://192.168.1.3:8443 + - url: https://192.168.1.3:8443 tags: - name: login @@ -26,6 +26,8 @@ paths: post: summary: Login user description: Loging using sha512 hash + security: + - basicAuth: [spaceti] requestBody: description: Optional description in *Markdown* required: true @@ -46,13 +48,13 @@ paths: "200": description: Login success content: - "*/*": + application/json: schema: $ref: "#/components/schemas/Token" "400": description: "" content: - "*/*": + application/json: schema: $ref: "#/components/schemas/Token" /SubjectManager/getSubjects: @@ -102,16 +104,20 @@ components: properties: username: type: string + example: spaceti password: type: string + example: E7FEA07DBC82FB9BA34B2E453E2EFE89F0583E7187543507EF11E84726071FE428445372F2E46B455EB0C79747C51E362F403CE39473A2A8C2DFA0CE5C9826C0 Token: type: object properties: - tokenType: + id: type: string - tokenBits: - type: integer + example: spaceti + token: + type: string + example: E7FEA07DBC82FB9BA34B2E453E2EFE89F0583E7187543507EF11E84726071FE428445372F2E46B455EB0C79747C51E362F403CE39473A2A8C2DFA0CE5C9826C0 # security: # - basicAuth: [d] # <-- use the same name here \ No newline at end of file diff --git a/snowboard.yml b/snowboard.yml new file mode 100644 index 0000000..9714a41 --- /dev/null +++ b/snowboard.yml @@ -0,0 +1,30 @@ +html: + playground: + enabled: true + env: development + environments: + development: + url: https://192.168.1.3:8443 + auth: + name: basic + options: + username: spaceti + password: E7FEA07DBC82FB9BA34B2E453E2EFE89F0583E7187543507EF11E84726071FE428445372F2E46B455EB0C79747C51E362F403CE39473A2A8C2DFA0CE5C9826C0 + staging: + url: https://staging.example.com/ + auth: + name: basic + options: + username: admin + password: secret + production: + url: https://api.example.com + auth: + name: oauth2 + options: + authorizeUrl: https://accounts.example.com/oauth/authorize + tokenUrl: https://accounts.example.com/oauth/access_token + callbackUrl: https://www.example.com + clientId: + clientSecret: + scopes: \ No newline at end of file