diff --git a/build.gradle b/build.gradle index 0cda6c99be28abeebbae9270b65e247d164bf537..db1ec197829cd685633da87968e67ba8c15aafaa 100644 --- a/build.gradle +++ b/build.gradle @@ -32,6 +32,7 @@ dependencies { testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: "${junit_jupiter_version}" testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: "${junit_jupiter_version}" + testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-params', version: "${junit_jupiter_version}" testImplementation group: 'com.jayway.jsonpath', name: 'json-path', version: "${json_path_version}" } @@ -53,6 +54,7 @@ jar { } test { + testLogging.showStandardStreams = true useJUnitPlatform() maxHeapSize = '1G' @@ -66,20 +68,18 @@ def relastOutputFiles = [ "src/gen/jastadd/OpenAPISpecification.ast", "src/gen/jastadd/OpenAPISpecification.jadd" ] -def genAst = [ - "src/gen/jastadd/RelAst.ast" -] def grammarDiagramFile = './src/gen/resources/diagrams/grammar/openapiRelast.png' task generateGrammarDiagrams(type: JavaExec) { group = 'Documentation' classpath = configurations.grammar2uml + main = 'de.tudresden.inf.st.jastadd.grammar2uml.compiler.Compiler' args "--output=${grammarDiagramFile}", '--defaultFolders' - args genAst + args relastInputFiles - inputs.files genAst + inputs.files relastInputFiles outputs.files file(grammarDiagramFile) } diff --git a/gradle.properties b/gradle.properties index c0b50526cb7547533c933897a1db274967747899..bd099a2909758dbb009fee0daf90170d78eb03b0 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,4 +3,4 @@ swagger_parser_version = 2.0.30 junit_jupiter_version = 5.7.0 json_path_version = 2.6.0 jastaddgradle_version = 1.13.3 -grammar2uml_version = 0.2.1 \ No newline at end of file +grammar2uml_version = 0.2.2-13 \ No newline at end of file diff --git a/pages/docs/index.md b/pages/docs/index.md index 9f7cda8ed5fcaff95eb3e5566a6609dc61696f6b..19e436a3fce9dd0313eeeaf341903c3093b4b2e6 100644 --- a/pages/docs/index.md +++ b/pages/docs/index.md @@ -1 +1,3 @@ -Index \ No newline at end of file +Index + + \ No newline at end of file diff --git a/src/main/resources/3.0/api-with-examples.json b/src/main/resources/3.0/api-with-examples.json new file mode 100644 index 0000000000000000000000000000000000000000..0fd2077b3e00e0e735283cfaef254627fba6d47f --- /dev/null +++ b/src/main/resources/3.0/api-with-examples.json @@ -0,0 +1,167 @@ +{ + "openapi": "3.0.0", + "info": { + "title": "Simple API overview", + "version": "2.0.0" + }, + "paths": { + "/": { + "get": { + "operationId": "listVersionsv2", + "summary": "List API versions", + "responses": { + "200": { + "description": "200 response", + "content": { + "application/json": { + "examples": { + "foo": { + "value": { + "versions": [ + { + "status": "CURRENT", + "updated": "2011-01-21T11:33:21Z", + "id": "v2.0", + "links": [ + { + "href": "http://127.0.0.1:8774/v2/", + "rel": "self" + } + ] + }, + { + "status": "EXPERIMENTAL", + "updated": "2013-07-23T11:33:21Z", + "id": "v3.0", + "links": [ + { + "href": "http://127.0.0.1:8774/v3/", + "rel": "self" + } + ] + } + ] + } + } + } + } + } + }, + "300": { + "description": "300 response", + "content": { + "application/json": { + "examples": { + "foo": { + "value": "{\n \"versions\": [\n {\n \"status\": \"CURRENT\",\n \"updated\": \"2011-01-21T11:33:21Z\",\n \"id\": \"v2.0\",\n \"links\": [\n {\n \"href\": \"http://127.0.0.1:8774/v2/\",\n \"rel\": \"self\"\n }\n ]\n },\n {\n \"status\": \"EXPERIMENTAL\",\n \"updated\": \"2013-07-23T11:33:21Z\",\n \"id\": \"v3.0\",\n \"links\": [\n {\n \"href\": \"http://127.0.0.1:8774/v3/\",\n \"rel\": \"self\"\n }\n ]\n }\n ]\n}\n" + } + } + } + } + } + } + } + }, + "/v2": { + "get": { + "operationId": "getVersionDetailsv2", + "summary": "Show API version details", + "responses": { + "200": { + "description": "200 response", + "content": { + "application/json": { + "examples": { + "foo": { + "value": { + "version": { + "status": "CURRENT", + "updated": "2011-01-21T11:33:21Z", + "media-types": [ + { + "base": "application/xml", + "type": "application/vnd.openstack.compute+xml;version=2" + }, + { + "base": "application/json", + "type": "application/vnd.openstack.compute+json;version=2" + } + ], + "id": "v2.0", + "links": [ + { + "href": "http://127.0.0.1:8774/v2/", + "rel": "self" + }, + { + "href": "http://docs.openstack.org/api/openstack-compute/2/os-compute-devguide-2.pdf", + "type": "application/pdf", + "rel": "describedby" + }, + { + "href": "http://docs.openstack.org/api/openstack-compute/2/wadl/os-compute-2.wadl", + "type": "application/vnd.sun.wadl+xml", + "rel": "describedby" + }, + { + "href": "http://docs.openstack.org/api/openstack-compute/2/wadl/os-compute-2.wadl", + "type": "application/vnd.sun.wadl+xml", + "rel": "describedby" + } + ] + } + } + } + } + } + } + }, + "203": { + "description": "203 response", + "content": { + "application/json": { + "examples": { + "foo": { + "value": { + "version": { + "status": "CURRENT", + "updated": "2011-01-21T11:33:21Z", + "media-types": [ + { + "base": "application/xml", + "type": "application/vnd.openstack.compute+xml;version=2" + }, + { + "base": "application/json", + "type": "application/vnd.openstack.compute+json;version=2" + } + ], + "id": "v2.0", + "links": [ + { + "href": "http://23.253.228.211:8774/v2/", + "rel": "self" + }, + { + "href": "http://docs.openstack.org/api/openstack-compute/2/os-compute-devguide-2.pdf", + "type": "application/pdf", + "rel": "describedby" + }, + { + "href": "http://docs.openstack.org/api/openstack-compute/2/wadl/os-compute-2.wadl", + "type": "application/vnd.sun.wadl+xml", + "rel": "describedby" + } + ] + } + } + } + } + } + } + } + } + } + } + } +} \ No newline at end of file diff --git a/src/main/resources/3.0/api-with-examples.yaml b/src/main/resources/3.0/api-with-examples.yaml new file mode 100644 index 0000000000000000000000000000000000000000..18726a547640cdeeeab94b2a41215bbd19294b36 --- /dev/null +++ b/src/main/resources/3.0/api-with-examples.yaml @@ -0,0 +1,170 @@ +openapi: "3.0.0" +info: + title: Simple API overview + version: 2.0.0 +paths: + /: + get: + operationId: listVersionsv2 + summary: List API versions + responses: + '200': + description: |- + 200 response + content: + application/json: + examples: + foo: + value: + { + "versions": [ + { + "status": "CURRENT", + "updated": "2011-01-21T11:33:21Z", + "id": "v2.0", + "links": [ + { + "href": "http://127.0.0.1:8774/v2/", + "rel": "self" + } + ] + }, + { + "status": "EXPERIMENTAL", + "updated": "2013-07-23T11:33:21Z", + "id": "v3.0", + "links": [ + { + "href": "http://127.0.0.1:8774/v3/", + "rel": "self" + } + ] + } + ] + } + '300': + description: |- + 300 response + content: + application/json: + examples: + foo: + value: | + { + "versions": [ + { + "status": "CURRENT", + "updated": "2011-01-21T11:33:21Z", + "id": "v2.0", + "links": [ + { + "href": "http://127.0.0.1:8774/v2/", + "rel": "self" + } + ] + }, + { + "status": "EXPERIMENTAL", + "updated": "2013-07-23T11:33:21Z", + "id": "v3.0", + "links": [ + { + "href": "http://127.0.0.1:8774/v3/", + "rel": "self" + } + ] + } + ] + } + /v2: + get: + operationId: getVersionDetailsv2 + summary: Show API version details + responses: + '200': + description: |- + 200 response + content: + application/json: + examples: + foo: + value: + { + "version": { + "status": "CURRENT", + "updated": "2011-01-21T11:33:21Z", + "media-types": [ + { + "base": "application/xml", + "type": "application/vnd.openstack.compute+xml;version=2" + }, + { + "base": "application/json", + "type": "application/vnd.openstack.compute+json;version=2" + } + ], + "id": "v2.0", + "links": [ + { + "href": "http://127.0.0.1:8774/v2/", + "rel": "self" + }, + { + "href": "http://docs.openstack.org/api/openstack-compute/2/os-compute-devguide-2.pdf", + "type": "application/pdf", + "rel": "describedby" + }, + { + "href": "http://docs.openstack.org/api/openstack-compute/2/wadl/os-compute-2.wadl", + "type": "application/vnd.sun.wadl+xml", + "rel": "describedby" + }, + { + "href": "http://docs.openstack.org/api/openstack-compute/2/wadl/os-compute-2.wadl", + "type": "application/vnd.sun.wadl+xml", + "rel": "describedby" + } + ] + } + } + '203': + description: |- + 203 response + content: + application/json: + examples: + foo: + value: + { + "version": { + "status": "CURRENT", + "updated": "2011-01-21T11:33:21Z", + "media-types": [ + { + "base": "application/xml", + "type": "application/vnd.openstack.compute+xml;version=2" + }, + { + "base": "application/json", + "type": "application/vnd.openstack.compute+json;version=2" + } + ], + "id": "v2.0", + "links": [ + { + "href": "http://23.253.228.211:8774/v2/", + "rel": "self" + }, + { + "href": "http://docs.openstack.org/api/openstack-compute/2/os-compute-devguide-2.pdf", + "type": "application/pdf", + "rel": "describedby" + }, + { + "href": "http://docs.openstack.org/api/openstack-compute/2/wadl/os-compute-2.wadl", + "type": "application/vnd.sun.wadl+xml", + "rel": "describedby" + } + ] + } + } diff --git a/src/main/resources/3.0/callback-example.json b/src/main/resources/3.0/callback-example.json new file mode 100644 index 0000000000000000000000000000000000000000..9a4df39b45370fdc3139e7f682c41bad6f053bd5 --- /dev/null +++ b/src/main/resources/3.0/callback-example.json @@ -0,0 +1,84 @@ +{ + "openapi": "3.0.0", + "info": { + "title": "Callback Example", + "version": "1.0.0" + }, + "paths": { + "/streams": { + "post": { + "description": "subscribes a client to receive out-of-band data", + "parameters": [ + { + "name": "callbackUrl", + "in": "query", + "required": true, + "description": "the location where data will be sent. Must be network accessible\nby the source server\n", + "schema": { + "type": "string", + "format": "uri", + "example": "https://tonys-server.com" + } + } + ], + "responses": { + "201": { + "description": "subscription successfully created", + "content": { + "application/json": { + "schema": { + "description": "subscription information", + "required": [ + "subscriptionId" + ], + "properties": { + "subscriptionId": { + "description": "this unique identifier allows management of the subscription", + "type": "string", + "example": "2531329f-fb09-4ef7-887e-84e648214436" + } + } + } + } + } + } + }, + "callbacks": { + "onData": { + "{$request.query.callbackUrl}/data": { + "post": { + "requestBody": { + "description": "subscription payload", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "timestamp": { + "type": "string", + "format": "date-time" + }, + "userData": { + "type": "string" + } + } + } + } + } + }, + "responses": { + "202": { + "description": "Your server implementation should return this HTTP status code\nif the data was received successfully\n" + }, + "204": { + "description": "Your server should return this HTTP status code if no longer interested\nin further updates\n" + } + } + } + } + } + } + } + } + } +} \ No newline at end of file diff --git a/src/main/resources/3.0/callback-example.yaml b/src/main/resources/3.0/callback-example.yaml new file mode 100644 index 0000000000000000000000000000000000000000..262b8df5181a3c35d193144737ca9dd11554acd6 --- /dev/null +++ b/src/main/resources/3.0/callback-example.yaml @@ -0,0 +1,61 @@ +openapi: 3.0.0 +info: + title: Callback Example + version: 1.0.0 +paths: + /streams: + post: + description: subscribes a client to receive out-of-band data + parameters: + - name: callbackUrl + in: query + required: true + description: | + the location where data will be sent. Must be network accessible + by the source server + schema: + type: string + format: uri + example: https://tonys-server.com + responses: + '201': + description: subscription successfully created + content: + application/json: + schema: + description: subscription information + required: + - subscriptionId + properties: + subscriptionId: + description: this unique identifier allows management of the subscription + type: string + example: 2531329f-fb09-4ef7-887e-84e648214436 + callbacks: + # the name `onData` is a convenience locator + onData: + # when data is sent, it will be sent to the `callbackUrl` provided + # when making the subscription PLUS the suffix `/data` + '{$request.query.callbackUrl}/data': + post: + requestBody: + description: subscription payload + content: + application/json: + schema: + type: object + properties: + timestamp: + type: string + format: date-time + userData: + type: string + responses: + '202': + description: | + Your server implementation should return this HTTP status code + if the data was received successfully + '204': + description: | + Your server should return this HTTP status code if no longer interested + in further updates diff --git a/src/main/resources/3.0/link-example.json b/src/main/resources/3.0/link-example.json new file mode 100644 index 0000000000000000000000000000000000000000..bc98e635f1a4c9a44f2f283a170c4dfd701dd306 --- /dev/null +++ b/src/main/resources/3.0/link-example.json @@ -0,0 +1,323 @@ +{ + "openapi": "3.0.0", + "info": { + "title": "Link Example", + "version": "1.0.0" + }, + "paths": { + "/2.0/users/{username}": { + "get": { + "operationId": "getUserByName", + "parameters": [ + { + "name": "username", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The User", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/user" + } + } + }, + "links": { + "userRepositories": { + "$ref": "#/components/links/UserRepositories" + } + } + } + } + } + }, + "/2.0/repositories/{username}": { + "get": { + "operationId": "getRepositoriesByOwner", + "parameters": [ + { + "name": "username", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "repositories owned by the supplied user", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/repository" + } + } + } + }, + "links": { + "userRepository": { + "$ref": "#/components/links/UserRepository" + } + } + } + } + } + }, + "/2.0/repositories/{username}/{slug}": { + "get": { + "operationId": "getRepository", + "parameters": [ + { + "name": "username", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "slug", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The repository", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/repository" + } + } + }, + "links": { + "repositoryPullRequests": { + "$ref": "#/components/links/RepositoryPullRequests" + } + } + } + } + } + }, + "/2.0/repositories/{username}/{slug}/pullrequests": { + "get": { + "operationId": "getPullRequestsByRepository", + "parameters": [ + { + "name": "username", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "slug", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "state", + "in": "query", + "schema": { + "type": "string", + "enum": [ + "open", + "merged", + "declined" + ] + } + } + ], + "responses": { + "200": { + "description": "an array of pull request objects", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/pullrequest" + } + } + } + } + } + } + } + }, + "/2.0/repositories/{username}/{slug}/pullrequests/{pid}": { + "get": { + "operationId": "getPullRequestsById", + "parameters": [ + { + "name": "username", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "slug", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "pid", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "a pull request object", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/pullrequest" + } + } + }, + "links": { + "pullRequestMerge": { + "$ref": "#/components/links/PullRequestMerge" + } + } + } + } + } + }, + "/2.0/repositories/{username}/{slug}/pullrequests/{pid}/merge": { + "post": { + "operationId": "mergePullRequest", + "parameters": [ + { + "name": "username", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "slug", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "pid", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "204": { + "description": "the PR was successfully merged" + } + } + } + } + }, + "components": { + "links": { + "UserRepositories": { + "operationId": "getRepositoriesByOwner", + "parameters": { + "username": "$response.body#/username" + } + }, + "UserRepository": { + "operationId": "getRepository", + "parameters": { + "username": "$response.body#/owner/username", + "slug": "$response.body#/slug" + } + }, + "RepositoryPullRequests": { + "operationId": "getPullRequestsByRepository", + "parameters": { + "username": "$response.body#/owner/username", + "slug": "$response.body#/slug" + } + }, + "PullRequestMerge": { + "operationId": "mergePullRequest", + "parameters": { + "username": "$response.body#/author/username", + "slug": "$response.body#/repository/slug", + "pid": "$response.body#/id" + } + } + }, + "schemas": { + "user": { + "type": "object", + "properties": { + "username": { + "type": "string" + }, + "uuid": { + "type": "string" + } + } + }, + "repository": { + "type": "object", + "properties": { + "slug": { + "type": "string" + }, + "owner": { + "$ref": "#/components/schemas/user" + } + } + }, + "pullrequest": { + "type": "object", + "properties": { + "id": { + "type": "integer" + }, + "title": { + "type": "string" + }, + "repository": { + "$ref": "#/components/schemas/repository" + }, + "author": { + "$ref": "#/components/schemas/user" + } + } + } + } + } +} \ No newline at end of file diff --git a/src/main/resources/3.0/link-example.yaml b/src/main/resources/3.0/link-example.yaml new file mode 100644 index 0000000000000000000000000000000000000000..5837d705ee5a76114768160450b8460039267251 --- /dev/null +++ b/src/main/resources/3.0/link-example.yaml @@ -0,0 +1,203 @@ +openapi: 3.0.0 +info: + title: Link Example + version: 1.0.0 +paths: + /2.0/users/{username}: + get: + operationId: getUserByName + parameters: + - name: username + in: path + required: true + schema: + type: string + responses: + '200': + description: The User + content: + application/json: + schema: + $ref: '#/components/schemas/user' + links: + userRepositories: + $ref: '#/components/links/UserRepositories' + /2.0/repositories/{username}: + get: + operationId: getRepositoriesByOwner + parameters: + - name: username + in: path + required: true + schema: + type: string + responses: + '200': + description: repositories owned by the supplied user + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/repository' + links: + userRepository: + $ref: '#/components/links/UserRepository' + /2.0/repositories/{username}/{slug}: + get: + operationId: getRepository + parameters: + - name: username + in: path + required: true + schema: + type: string + - name: slug + in: path + required: true + schema: + type: string + responses: + '200': + description: The repository + content: + application/json: + schema: + $ref: '#/components/schemas/repository' + links: + repositoryPullRequests: + $ref: '#/components/links/RepositoryPullRequests' + /2.0/repositories/{username}/{slug}/pullrequests: + get: + operationId: getPullRequestsByRepository + parameters: + - name: username + in: path + required: true + schema: + type: string + - name: slug + in: path + required: true + schema: + type: string + - name: state + in: query + schema: + type: string + enum: + - open + - merged + - declined + responses: + '200': + description: an array of pull request objects + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/pullrequest' + /2.0/repositories/{username}/{slug}/pullrequests/{pid}: + get: + operationId: getPullRequestsById + parameters: + - name: username + in: path + required: true + schema: + type: string + - name: slug + in: path + required: true + schema: + type: string + - name: pid + in: path + required: true + schema: + type: string + responses: + '200': + description: a pull request object + content: + application/json: + schema: + $ref: '#/components/schemas/pullrequest' + links: + pullRequestMerge: + $ref: '#/components/links/PullRequestMerge' + /2.0/repositories/{username}/{slug}/pullrequests/{pid}/merge: + post: + operationId: mergePullRequest + parameters: + - name: username + in: path + required: true + schema: + type: string + - name: slug + in: path + required: true + schema: + type: string + - name: pid + in: path + required: true + schema: + type: string + responses: + '204': + description: the PR was successfully merged +components: + links: + UserRepositories: + # returns array of '#/components/schemas/repository' + operationId: getRepositoriesByOwner + parameters: + username: $response.body#/username + UserRepository: + # returns '#/components/schemas/repository' + operationId: getRepository + parameters: + username: $response.body#/owner/username + slug: $response.body#/slug + RepositoryPullRequests: + # returns '#/components/schemas/pullrequest' + operationId: getPullRequestsByRepository + parameters: + username: $response.body#/owner/username + slug: $response.body#/slug + PullRequestMerge: + # executes /2.0/repositories/{username}/{slug}/pullrequests/{pid}/merge + operationId: mergePullRequest + parameters: + username: $response.body#/author/username + slug: $response.body#/repository/slug + pid: $response.body#/id + schemas: + user: + type: object + properties: + username: + type: string + uuid: + type: string + repository: + type: object + properties: + slug: + type: string + owner: + $ref: '#/components/schemas/user' + pullrequest: + type: object + properties: + id: + type: integer + title: + type: string + repository: + $ref: '#/components/schemas/repository' + author: + $ref: '#/components/schemas/user' diff --git a/src/main/resources/3.0/petstore-expanded.json b/src/main/resources/3.0/petstore-expanded.json new file mode 100644 index 0000000000000000000000000000000000000000..9bd527fa389b79aaa58bca2cb3410b8d06cb029e --- /dev/null +++ b/src/main/resources/3.0/petstore-expanded.json @@ -0,0 +1,242 @@ +{ + "openapi": "3.0.0", + "info": { + "version": "1.0.0", + "title": "Swagger Petstore", + "description": "A sample API that uses a petstore as an example to demonstrate features in the OpenAPI 3.0 specification", + "termsOfService": "http://swagger.io/terms/", + "contact": { + "name": "Swagger API Team", + "email": "apiteam@swagger.io", + "url": "http://swagger.io" + }, + "license": { + "name": "Apache 2.0", + "url": "https://www.apache.org/licenses/LICENSE-2.0.html" + } + }, + "servers": [ + { + "url": "http://petstore.swagger.io/api" + } + ], + "paths": { + "/pets": { + "get": { + "description": "Returns all pets from the system that the user has access to\nNam sed condimentum est. Maecenas tempor sagittis sapien, nec rhoncus sem sagittis sit amet. Aenean at gravida augue, ac iaculis sem. Curabitur odio lorem, ornare eget elementum nec, cursus id lectus. Duis mi turpis, pulvinar ac eros ac, tincidunt varius justo. In hac habitasse platea dictumst. Integer at adipiscing ante, a sagittis ligula. Aenean pharetra tempor ante molestie imperdiet. Vivamus id aliquam diam. Cras quis velit non tortor eleifend sagittis. Praesent at enim pharetra urna volutpat venenatis eget eget mauris. In eleifend fermentum facilisis. Praesent enim enim, gravida ac sodales sed, placerat id erat. Suspendisse lacus dolor, consectetur non augue vel, vehicula interdum libero. Morbi euismod sagittis libero sed lacinia.\n\nSed tempus felis lobortis leo pulvinar rutrum. Nam mattis velit nisl, eu condimentum ligula luctus nec. Phasellus semper velit eget aliquet faucibus. In a mattis elit. Phasellus vel urna viverra, condimentum lorem id, rhoncus nibh. Ut pellentesque posuere elementum. Sed a varius odio. Morbi rhoncus ligula libero, vel eleifend nunc tristique vitae. Fusce et sem dui. Aenean nec scelerisque tortor. Fusce malesuada accumsan magna vel tempus. Quisque mollis felis eu dolor tristique, sit amet auctor felis gravida. Sed libero lorem, molestie sed nisl in, accumsan tempor nisi. Fusce sollicitudin massa ut lacinia mattis. Sed vel eleifend lorem. Pellentesque vitae felis pretium, pulvinar elit eu, euismod sapien.\n", + "operationId": "findPets", + "parameters": [ + { + "name": "tags", + "in": "query", + "description": "tags to filter by", + "required": false, + "style": "form", + "schema": { + "type": "array", + "items": { + "type": "string" + } + } + }, + { + "name": "limit", + "in": "query", + "description": "maximum number of results to return", + "required": false, + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "responses": { + "200": { + "description": "pet response", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Pet" + } + } + } + } + }, + "default": { + "description": "unexpected error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "post": { + "description": "Creates a new pet in the store. Duplicates are allowed", + "operationId": "addPet", + "requestBody": { + "description": "Pet to add to the store", + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/NewPet" + } + } + } + }, + "responses": { + "200": { + "description": "pet response", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Pet" + } + } + } + }, + "default": { + "description": "unexpected error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/pets/{id}": { + "get": { + "description": "Returns a user based on a single ID, if the user does not have access to the pet", + "operationId": "find pet by id", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "ID of pet to fetch", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + ], + "responses": { + "200": { + "description": "pet response", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Pet" + } + } + } + }, + "default": { + "description": "unexpected error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "delete": { + "description": "deletes a single pet based on the ID supplied", + "operationId": "deletePet", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "ID of pet to delete", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + ], + "responses": { + "204": { + "description": "pet deleted" + }, + "default": { + "description": "unexpected error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + } + }, + "components": { + "schemas": { + "Pet": { + "allOf": [ + { + "$ref": "#/components/schemas/NewPet" + }, + { + "type": "object", + "required": [ + "id" + ], + "properties": { + "id": { + "type": "integer", + "format": "int64" + } + } + } + ] + }, + "NewPet": { + "type": "object", + "required": [ + "name" + ], + "properties": { + "name": { + "type": "string" + }, + "tag": { + "type": "string" + } + } + }, + "Error": { + "type": "object", + "required": [ + "code", + "message" + ], + "properties": { + "code": { + "type": "integer", + "format": "int32" + }, + "message": { + "type": "string" + } + } + } + } + } +} \ No newline at end of file diff --git a/src/main/resources/3.0/petstore-expanded.yaml b/src/main/resources/3.0/petstore-expanded.yaml new file mode 100644 index 0000000000000000000000000000000000000000..acd46d911ba7124132b1793d95d49fcec6e06621 --- /dev/null +++ b/src/main/resources/3.0/petstore-expanded.yaml @@ -0,0 +1,158 @@ +openapi: "3.0.0" +info: + version: 1.0.0 + title: Swagger Petstore + description: A sample API that uses a petstore as an example to demonstrate features in the OpenAPI 3.0 specification + termsOfService: http://swagger.io/terms/ + contact: + name: Swagger API Team + email: apiteam@swagger.io + url: http://swagger.io + license: + name: Apache 2.0 + url: https://www.apache.org/licenses/LICENSE-2.0.html +servers: + - url: http://petstore.swagger.io/api +paths: + /pets: + get: + description: | + Returns all pets from the system that the user has access to + Nam sed condimentum est. Maecenas tempor sagittis sapien, nec rhoncus sem sagittis sit amet. Aenean at gravida augue, ac iaculis sem. Curabitur odio lorem, ornare eget elementum nec, cursus id lectus. Duis mi turpis, pulvinar ac eros ac, tincidunt varius justo. In hac habitasse platea dictumst. Integer at adipiscing ante, a sagittis ligula. Aenean pharetra tempor ante molestie imperdiet. Vivamus id aliquam diam. Cras quis velit non tortor eleifend sagittis. Praesent at enim pharetra urna volutpat venenatis eget eget mauris. In eleifend fermentum facilisis. Praesent enim enim, gravida ac sodales sed, placerat id erat. Suspendisse lacus dolor, consectetur non augue vel, vehicula interdum libero. Morbi euismod sagittis libero sed lacinia. + + Sed tempus felis lobortis leo pulvinar rutrum. Nam mattis velit nisl, eu condimentum ligula luctus nec. Phasellus semper velit eget aliquet faucibus. In a mattis elit. Phasellus vel urna viverra, condimentum lorem id, rhoncus nibh. Ut pellentesque posuere elementum. Sed a varius odio. Morbi rhoncus ligula libero, vel eleifend nunc tristique vitae. Fusce et sem dui. Aenean nec scelerisque tortor. Fusce malesuada accumsan magna vel tempus. Quisque mollis felis eu dolor tristique, sit amet auctor felis gravida. Sed libero lorem, molestie sed nisl in, accumsan tempor nisi. Fusce sollicitudin massa ut lacinia mattis. Sed vel eleifend lorem. Pellentesque vitae felis pretium, pulvinar elit eu, euismod sapien. + operationId: findPets + parameters: + - name: tags + in: query + description: tags to filter by + required: false + style: form + schema: + type: array + items: + type: string + - name: limit + in: query + description: maximum number of results to return + required: false + schema: + type: integer + format: int32 + responses: + '200': + description: pet response + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/Pet' + default: + description: unexpected error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + post: + description: Creates a new pet in the store. Duplicates are allowed + operationId: addPet + requestBody: + description: Pet to add to the store + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/NewPet' + responses: + '200': + description: pet response + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + default: + description: unexpected error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + /pets/{id}: + get: + description: Returns a user based on a single ID, if the user does not have access to the pet + operationId: find pet by id + parameters: + - name: id + in: path + description: ID of pet to fetch + required: true + schema: + type: integer + format: int64 + responses: + '200': + description: pet response + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + default: + description: unexpected error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + delete: + description: deletes a single pet based on the ID supplied + operationId: deletePet + parameters: + - name: id + in: path + description: ID of pet to delete + required: true + schema: + type: integer + format: int64 + responses: + '204': + description: pet deleted + default: + description: unexpected error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' +components: + schemas: + Pet: + allOf: + - $ref: '#/components/schemas/NewPet' + - type: object + required: + - id + properties: + id: + type: integer + format: int64 + + NewPet: + type: object + required: + - name + properties: + name: + type: string + tag: + type: string + + Error: + type: object + required: + - code + - message + properties: + code: + type: integer + format: int32 + message: + type: string diff --git a/src/main/resources/3.0/richard_mueller4-MatchinitAPI-1-swagger.json b/src/main/resources/3.0/richard_mueller4-MatchinitAPI-1-swagger.json new file mode 100644 index 0000000000000000000000000000000000000000..c1537c716ec2b475f828fe813eb144eb1a68abd7 --- /dev/null +++ b/src/main/resources/3.0/richard_mueller4-MatchinitAPI-1-swagger.json @@ -0,0 +1,691 @@ +{ + "openapi" : "3.0.0", + "info" : { + "version" : "1", + "title" : "Server - mobile App - API", + "description" : "This API describes the communication between the mobile App and MatchinitServer" + }, + "paths" : { + "/matches/" : { + "get" : { + "summary" : "Used to retrive new possible matches.", + "tags" : [ "Matches" ], + "parameters" : [ { + "$ref" : "#/components/parameters/ownUserID" + } ], + "responses" : { + "200" : { + "$ref" : "#/components/responses/Matches" + } + } + } + }, + "/matches/confirmed/" : { + "get" : { + "summary" : "Used to retrive already matched users.", + "tags" : [ "Matches" ], + "parameters" : [ { + "$ref" : "#/components/parameters/ownUserID" + } ], + "operationId" : "getUserDetails", + "responses" : { + "200" : { + "$ref" : "#/components/responses/Matches" + } + } + } + }, + "/matches/like/" : { + "post" : { + "summary" : "Used to like a user possibly confirming a match.", + "tags" : [ "Matches" ], + "parameters" : [ { + "$ref" : "#/components/parameters/UserID" + }, { + "$ref" : "#/components/parameters/ownUserID" + } ], + "responses" : { + "200" : { + "description" : "ok" + } + } + } + }, + "/matches/dislike/" : { + "post" : { + "summary" : "Used to dislike a user reducing his matching score in the process.", + "tags" : [ "Matches" ], + "parameters" : [ { + "$ref" : "#/components/parameters/UserID" + }, { + "$ref" : "#/components/parameters/ownUserID" + } ], + "responses" : { + "200" : { + "description" : "ok" + } + } + } + }, + "/profile/details/" : { + "get" : { + "summary" : "Used to retrive basic informations of a user-profile", + "tags" : [ "User" ], + "parameters" : [ { + "$ref" : "#/components/parameters/UserID" + } ], + "responses" : { + "200" : { + "$ref" : "#/components/responses/UserDetails" + } + } + }, + "post" : { + "summary" : "Used to set own profile data", + "tags" : [ "User" ], + "parameters" : [ { + "$ref" : "#/components/parameters/UserID" + } ], + "requestBody" : { + "$ref" : "#/components/requestBodies/UserDetails" + }, + "responses" : { + "200" : { + "description" : "ok" + } + } + } + }, + "/profile/preferences" : { + "get" : { + "summary" : "Used to retrieve matching preferences of the given user", + "tags" : [ "User" ], + "parameters" : [ { + "$ref" : "#/components/parameters/UserID" + } ], + "responses" : { + "200" : { + "$ref" : "#/components/responses/ProfileSettings" + } + } + }, + "post" : { + "summary" : "Used to change preference settings of a profile", + "tags" : [ "User" ], + "parameters" : [ { + "$ref" : "#/components/parameters/UserID" + } ], + "requestBody" : { + "$ref" : "#/components/requestBodies/ProfileSettings" + }, + "responses" : { + "200" : { + "description" : "ok" + } + } + } + }, + "/user/register" : { + "put" : { + "summary" : "Used to register from the mobile app.", + "tags" : [ "User" ], + "requestBody" : { + "$ref" : "#/components/requestBodies/RegisterData" + }, + "responses" : { + "200" : { + "description" : "ok" + } + } + } + }, + "/channels/global" : { + "get" : { + "summary" : "Used to retrieve messages of the global channel of a domain", + "tags" : [ "Channels" ], + "parameters" : [ { + "$ref" : "#/components/parameters/timestamp" + }, { + "$ref" : "#/components/parameters/numberOfMessages" + } ], + "responses" : { + "200" : { + "$ref" : "#/components/responses/GlobalChannelMessage" + } + } + }, + "put" : { + "summary" : "Used to send messages to the global channel of a domain", + "tags" : [ "Channels" ], + "requestBody" : { + "$ref" : "#/components/requestBodies/SendGlobalChannelMessage" + }, + "responses" : { + "201" : { + "description" : "created" + }, + "403" : { + "description" : "Banned" + } + } + }, + "delete" : { + "summary" : "Moderators can use this to delete Messages.", + "tags" : [ "Channels" ], + "parameters" : [ { + "$ref" : "#/components/parameters/MessageID" + } ], + "responses" : { + "200" : { + "description" : "deleted" + }, + "403" : { + "description" : "not a moderator" + } + } + } + }, + "/channels/global/ban" : { + "post" : { + "summary" : "Moderators can use this to temporarly ban people", + "tags" : [ "Channels" ], + "requestBody" : { + "$ref" : "#/components/requestBodies/Ban" + }, + "responses" : { + "200" : { + "description" : "ok" + }, + "403" : { + "description" : "not a moderator" + } + } + } + }, + "/game/details/" : { + "get" : { + "summary" : "Used to retrieve an overview of gamification details.", + "tags" : [ "Gamification" ], + "parameters" : [ { + "$ref" : "#/components/parameters/ownUserID" + } ], + "responses" : { + "200" : { + "$ref" : "#/components/responses/GamificationDetails" + } + } + } + }, + "/game/score/{gameID}/" : { + "get" : { + "summary" : "Used to retrieve Highscore list with own spot and surrounding places.", + "tags" : [ "Gamification" ], + "parameters" : [ { + "$ref" : "#/components/parameters/ownUserID" + }, { + "$ref" : "#/components/parameters/GameID" + } ], + "responses" : { + "200" : { + "$ref" : "#/components/responses/Highscores" + } + } + } + }, + "/game/refresh/" : { + "get" : { + "summary" : "Used to refresh scores of games outside of the mobile app.", + "tags" : [ "Gamification" ], + "description" : "This request will be forwarded to the Matchinit-Cube-Proxy Server of a certain user domain / Cube network, and will be forwarded further to the specific Cube Server.", + "parameters" : [ { + "$ref" : "#/components/parameters/ownUserID" + } ], + "responses" : { + "200" : { + "$ref" : "#/components/responses/GamificationDetails" + } + } + } + } + }, + "servers" : [ { + "description" : "SwaggerHub API Auto Mocking", + "url" : "https://virtserver.swaggerhub.com/richard_mueller4/MatchinitAPI/1" + } ], + "components" : { + "schemas" : { + "User" : { + "type" : "object", + "properties" : { + "id" : { + "type" : "integer", + "example" : 81230 + }, + "name" : { + "type" : "string", + "example" : "Max Mustermann" + } + } + }, + "UserDetails" : { + "type" : "object", + "properties" : { + "name" : { + "type" : "string", + "example" : "Tim" + }, + "selfDescription" : { + "type" : "string", + "example" : "None" + } + } + }, + "UserRegisterData" : { + "type" : "object", + "properties" : { + "name" : { + "type" : "string", + "example" : "Max Mustermann" + }, + "email" : { + "type" : "string", + "example" : "maxm@tu-dresden.de" + } + } + }, + "Ban" : { + "type" : "object", + "properties" : { + "userToBanID" : { + "type" : "integer", + "example" : 332542 + }, + "ownUserID" : { + "type" : "integer", + "example" : 824923 + }, + "reason" : { + "type" : "string", + "example" : "wrote something bad" + }, + "messageOfSuspect" : { + "type" : "integer", + "example" : 763423 + } + } + }, + "PotentialMatches" : { + "type" : "object", + "properties" : { + "matched_users" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/User" + }, + "example" : [ { + "id" : 1353143, + "name" : "Max Musterman" + }, { + "id" : 1245424, + "name" : "Sören Sörenson" + } ] + } + } + }, + "ChannelMessage" : { + "type" : "object", + "properties" : { + "date" : { + "type" : "string", + "format" : "date" + }, + "message" : { + "type" : "string", + "minimum" : 1, + "maximum" : 20000, + "example" : "Hallo wie geht es euch allen im Uni-Channel ?" + }, + "userID" : { + "type" : "integer", + "example" : 35432412 + }, + "messageID" : { + "type" : "integer", + "example" : 29847 + } + } + }, + "SendChannelMessage" : { + "type" : "object", + "properties" : { + "message" : { + "type" : "string", + "minimum" : 1, + "maximum" : 20000, + "example" : "Hallo wie geht es euch allen im Uni-Channel ?" + }, + "userID" : { + "type" : "integer", + "example" : 35432412 + } + } + }, + "MatchPreference" : { + "type" : "object", + "properties" : { + "preference" : { + "type" : "string", + "example" : "MatchWithSameCourses" + }, + "value" : { + "type" : "boolean", + "example" : true + } + } + }, + "ProfileSettings" : { + "type" : "object", + "properties" : { + "showName" : { + "type" : "boolean" + }, + "showDescription" : { + "type" : "boolean" + }, + "showPicture" : { + "type" : "boolean" + }, + "showPreferences" : { + "type" : "boolean" + }, + "matchPreferences" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/MatchPreference" + } + } + } + }, + "GamificationDetails" : { + "type" : "object", + "properties" : { + "points" : { + "type" : "integer", + "example" : 32 + }, + "place" : { + "type" : "integer", + "example" : 1045 + }, + "level" : { + "type" : "integer", + "example" : 4 + }, + "bonuses" : { + "type" : "array", + "items" : { + "type" : "string" + }, + "example" : [ "DistancingBonus", "FreshAirBonus" ] + } + } + }, + "Score" : { + "type" : "object", + "properties" : { + "name" : { + "type" : "string", + "example" : "Max" + }, + "score" : { + "type" : "integer", + "example" : 2102 + }, + "place" : { + "type" : "integer", + "example" : 4 + } + } + }, + "UserID" : { + "type" : "integer" + } + }, + "responses" : { + "Users" : { + "description" : "Ok", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/User" + } + } + }, + "links" : { + "User" : { + "operationId" : "getUserDetails", + "parameters" : { + "userId" : "$response.body#/id" + } + } + } + }, + "Matches" : { + "description" : "Ok", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/PotentialMatches" + } + } + }, + "links" : { + "User" : { + "operationId" : "getUserDetails", + "parameters" : { + "userId" : "$response.body.matched_users#/id" + } + } + } + }, + "GlobalChannelMessage" : { + "description" : "ok", + "content" : { + "application/json" : { + "schema" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/ChannelMessage" + }, + "example" : [ { + "message" : "Hallo!", + "date" : "11.02.2014", + "userID" : 8263427, + "messageID" : 121523 + }, { + "message" : "Auch hallo!", + "date" : "12.02.2014", + "userID" : 1249731, + "messageID" : 903245 + } ] + } + } + }, + "links" : { + "User" : { + "operationId" : "getUserDetails", + "parameters" : { + "userId" : "$response.body#/userID" + } + } + } + }, + "ProfileSettings" : { + "description" : "ok", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ProfileSettings" + } + } + } + }, + "UserDetails" : { + "description" : "ok", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/UserDetails" + } + } + } + }, + "GamificationDetails" : { + "description" : "ok", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/GamificationDetails" + } + } + } + }, + "Highscores" : { + "description" : "ok", + "content" : { + "application/json" : { + "schema" : { + "type" : "object", + "properties" : { + "gameID" : { + "type" : "string", + "example" : "Lüften" + }, + "scores" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/Score" + } + } + } + } + } + } + } + }, + "requestBodies" : { + "RegisterData" : { + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/UserRegisterData" + } + } + } + }, + "GlobalChannelMessage" : { + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ChannelMessage" + } + } + } + }, + "SendGlobalChannelMessage" : { + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/SendChannelMessage" + } + } + } + }, + "ProfileSettings" : { + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ProfileSettings" + } + } + } + }, + "UserDetails" : { + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/UserDetails" + } + } + } + }, + "Ban" : { + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/Ban" + } + } + } + } + }, + "parameters" : { + "UserID" : { + "in" : "query", + "name" : "userID", + "schema" : { + "$ref" : "#/components/schemas/UserID" + }, + "required" : true + }, + "ownUserID" : { + "in" : "query", + "name" : "ownUserID", + "schema" : { + "$ref" : "#/components/schemas/UserID" + }, + "required" : true, + "description" : "Id of the user making the request." + }, + "timestamp" : { + "in" : "query", + "name" : "timestamp", + "description" : "can be used to load messages starting at a specific time (going backwards from that point on), if not used the newest messages are loaded", + "schema" : { + "type" : "string", + "format" : "date" + }, + "required" : false + }, + "numberOfMessages" : { + "in" : "query", + "name" : "nom", + "description" : "specifies the number of messages to query, if not used, a maximum amount of messages is returned", + "schema" : { + "type" : "integer" + }, + "required" : false + }, + "GameID" : { + "description" : "GameID of the single Game requested, or `global` for all scores", + "in" : "path", + "name" : "gameID", + "schema" : { + "type" : "string", + "example" : "Lüften" + }, + "required" : true + }, + "MessageID" : { + "description" : "ID of a Message", + "in" : "query", + "name" : "messageID", + "required" : true, + "schema" : { + "type" : "integer", + "example" : 524343 + } + } + } + } +} \ No newline at end of file diff --git a/src/main/resources/3.0/uspto.json b/src/main/resources/3.0/uspto.json new file mode 100644 index 0000000000000000000000000000000000000000..cd32f64c5fdc47889037e810e6cff2312d2267c9 --- /dev/null +++ b/src/main/resources/3.0/uspto.json @@ -0,0 +1,252 @@ +{ + "openapi": "3.0.1", + "servers": [ + { + "url": "{scheme}://developer.uspto.gov/ds-api", + "variables": { + "scheme": { + "description": "The Data Set API is accessible via https and http", + "enum": [ + "https", + "http" + ], + "default": "https" + } + } + } + ], + "info": { + "description": "The Data Set API (DSAPI) allows the public users to discover and search USPTO exported data sets. This is a generic API that allows USPTO users to make any CSV based data files searchable through API. With the help of GET call, it returns the list of data fields that are searchable. With the help of POST call, data can be fetched based on the filters on the field names. Please note that POST call is used to search the actual data. The reason for the POST call is that it allows users to specify any complex search criteria without worry about the GET size limitations as well as encoding of the input parameters.", + "version": "1.0.0", + "title": "USPTO Data Set API", + "contact": { + "name": "Open Data Portal", + "url": "https://developer.uspto.gov", + "email": "developer@uspto.gov" + } + }, + "tags": [ + { + "name": "metadata", + "description": "Find out about the data sets" + }, + { + "name": "search", + "description": "Search a data set" + } + ], + "paths": { + "/": { + "get": { + "tags": [ + "metadata" + ], + "operationId": "list-data-sets", + "summary": "List available data sets", + "responses": { + "200": { + "description": "Returns a list of data sets", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/dataSetList" + }, + "example": { + "total": 2, + "apis": [ + { + "apiKey": "oa_citations", + "apiVersionNumber": "v1", + "apiUrl": "https://developer.uspto.gov/ds-api/oa_citations/v1/fields", + "apiDocumentationUrl": "https://developer.uspto.gov/ds-api-docs/index.html?url=https://developer.uspto.gov/ds-api/swagger/docs/oa_citations.json" + }, + { + "apiKey": "cancer_moonshot", + "apiVersionNumber": "v1", + "apiUrl": "https://developer.uspto.gov/ds-api/cancer_moonshot/v1/fields", + "apiDocumentationUrl": "https://developer.uspto.gov/ds-api-docs/index.html?url=https://developer.uspto.gov/ds-api/swagger/docs/cancer_moonshot.json" + } + ] + } + } + } + } + } + } + }, + "/{dataset}/{version}/fields": { + "get": { + "tags": [ + "metadata" + ], + "summary": "Provides the general information about the API and the list of fields that can be used to query the dataset.", + "description": "This GET API returns the list of all the searchable field names that are in the oa_citations. Please see the 'fields' attribute which returns an array of field names. Each field or a combination of fields can be searched using the syntax options shown below.", + "operationId": "list-searchable-fields", + "parameters": [ + { + "name": "dataset", + "in": "path", + "description": "Name of the dataset.", + "required": true, + "example": "oa_citations", + "schema": { + "type": "string" + } + }, + { + "name": "version", + "in": "path", + "description": "Version of the dataset.", + "required": true, + "example": "v1", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The dataset API for the given version is found and it is accessible to consume.", + "content": { + "application/json": { + "schema": { + "type": "string" + } + } + } + }, + "404": { + "description": "The combination of dataset name and version is not found in the system or it is not published yet to be consumed by public.", + "content": { + "application/json": { + "schema": { + "type": "string" + } + } + } + } + } + } + }, + "/{dataset}/{version}/records": { + "post": { + "tags": [ + "search" + ], + "summary": "Provides search capability for the data set with the given search criteria.", + "description": "This API is based on Solr/Lucene Search. The data is indexed using SOLR. This GET API returns the list of all the searchable field names that are in the Solr Index. Please see the 'fields' attribute which returns an array of field names. Each field or a combination of fields can be searched using the Solr/Lucene Syntax. Please refer https://lucene.apache.org/core/3_6_2/queryparsersyntax.html#Overview for the query syntax. List of field names that are searchable can be determined using above GET api.", + "operationId": "perform-search", + "parameters": [ + { + "name": "version", + "in": "path", + "description": "Version of the dataset.", + "required": true, + "schema": { + "type": "string", + "default": "v1" + } + }, + { + "name": "dataset", + "in": "path", + "description": "Name of the dataset. In this case, the default value is oa_citations", + "required": true, + "schema": { + "type": "string", + "default": "oa_citations" + } + } + ], + "responses": { + "200": { + "description": "successful operation", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "type": "object", + "additionalProperties": { + "type": "object" + } + } + } + } + } + }, + "404": { + "description": "No matching record found for the given criteria." + } + }, + "requestBody": { + "content": { + "application/x-www-form-urlencoded": { + "schema": { + "type": "object", + "properties": { + "criteria": { + "description": "Uses Lucene Query Syntax in the format of propertyName:value, propertyName:[num1 TO num2] and date range format: propertyName:[yyyyMMdd TO yyyyMMdd]. In the response please see the 'docs' element which has the list of record objects. Each record structure would consist of all the fields and their corresponding values.", + "type": "string", + "default": "*:*" + }, + "start": { + "description": "Starting record number. Default value is 0.", + "type": "integer", + "default": 0 + }, + "rows": { + "description": "Specify number of rows to be returned. If you run the search with default values, in the response you will see 'numFound' attribute which will tell the number of records available in the dataset.", + "type": "integer", + "default": 100 + } + }, + "required": [ + "criteria" + ] + } + } + } + } + } + } + }, + "components": { + "schemas": { + "dataSetList": { + "type": "object", + "properties": { + "total": { + "type": "integer" + }, + "apis": { + "type": "array", + "items": { + "type": "object", + "properties": { + "apiKey": { + "type": "string", + "description": "To be used as a dataset parameter value" + }, + "apiVersionNumber": { + "type": "string", + "description": "To be used as a version parameter value" + }, + "apiUrl": { + "type": "string", + "format": "uriref", + "description": "The URL describing the dataset's fields" + }, + "apiDocumentationUrl": { + "type": "string", + "format": "uriref", + "description": "A URL to the API console for each API" + } + } + } + } + } + } + } + } +} \ No newline at end of file diff --git a/src/main/resources/3.0/uspto.yaml b/src/main/resources/3.0/uspto.yaml new file mode 100644 index 0000000000000000000000000000000000000000..d3011520d0ad1217fdede712db787260fb39eab0 --- /dev/null +++ b/src/main/resources/3.0/uspto.yaml @@ -0,0 +1,210 @@ +openapi: 3.0.1 +servers: + - url: '{scheme}://developer.uspto.gov/ds-api' + variables: + scheme: + description: 'The Data Set API is accessible via https and http' + enum: + - 'https' + - 'http' + default: 'https' +info: + description: >- + The Data Set API (DSAPI) allows the public users to discover and search + USPTO exported data sets. This is a generic API that allows USPTO users to + make any CSV based data files searchable through API. With the help of GET + call, it returns the list of data fields that are searchable. With the help + of POST call, data can be fetched based on the filters on the field names. + Please note that POST call is used to search the actual data. The reason for + the POST call is that it allows users to specify any complex search criteria + without worry about the GET size limitations as well as encoding of the + input parameters. + version: 1.0.0 + title: USPTO Data Set API + contact: + name: Open Data Portal + url: 'https://developer.uspto.gov' + email: developer@uspto.gov +tags: + - name: metadata + description: Find out about the data sets + - name: search + description: Search a data set +paths: + /: + get: + tags: + - metadata + operationId: list-data-sets + summary: List available data sets + responses: + '200': + description: Returns a list of data sets + content: + application/json: + schema: + $ref: '#/components/schemas/dataSetList' + example: + { + "total": 2, + "apis": [ + { + "apiKey": "oa_citations", + "apiVersionNumber": "v1", + "apiUrl": "https://developer.uspto.gov/ds-api/oa_citations/v1/fields", + "apiDocumentationUrl": "https://developer.uspto.gov/ds-api-docs/index.html?url=https://developer.uspto.gov/ds-api/swagger/docs/oa_citations.json" + }, + { + "apiKey": "cancer_moonshot", + "apiVersionNumber": "v1", + "apiUrl": "https://developer.uspto.gov/ds-api/cancer_moonshot/v1/fields", + "apiDocumentationUrl": "https://developer.uspto.gov/ds-api-docs/index.html?url=https://developer.uspto.gov/ds-api/swagger/docs/cancer_moonshot.json" + } + ] + } + /{dataset}/{version}/fields: + get: + tags: + - metadata + summary: >- + Provides the general information about the API and the list of fields + that can be used to query the dataset. + description: >- + This GET API returns the list of all the searchable field names that are + in the oa_citations. Please see the 'fields' attribute which returns an + array of field names. Each field or a combination of fields can be + searched using the syntax options shown below. + operationId: list-searchable-fields + parameters: + - name: dataset + in: path + description: 'Name of the dataset.' + required: true + example: "oa_citations" + schema: + type: string + - name: version + in: path + description: Version of the dataset. + required: true + example: "v1" + schema: + type: string + responses: + '200': + description: >- + The dataset API for the given version is found and it is accessible + to consume. + content: + application/json: + schema: + type: string + '404': + description: >- + The combination of dataset name and version is not found in the + system or it is not published yet to be consumed by public. + content: + application/json: + schema: + type: string + /{dataset}/{version}/records: + post: + tags: + - search + summary: >- + Provides search capability for the data set with the given search + criteria. + description: >- + This API is based on Solr/Lucene Search. The data is indexed using + SOLR. This GET API returns the list of all the searchable field names + that are in the Solr Index. Please see the 'fields' attribute which + returns an array of field names. Each field or a combination of fields + can be searched using the Solr/Lucene Syntax. Please refer + https://lucene.apache.org/core/3_6_2/queryparsersyntax.html#Overview for + the query syntax. List of field names that are searchable can be + determined using above GET api. + operationId: perform-search + parameters: + - name: version + in: path + description: Version of the dataset. + required: true + schema: + type: string + default: v1 + - name: dataset + in: path + description: 'Name of the dataset. In this case, the default value is oa_citations' + required: true + schema: + type: string + default: oa_citations + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: array + items: + type: object + additionalProperties: + type: object + '404': + description: No matching record found for the given criteria. + requestBody: + content: + application/x-www-form-urlencoded: + schema: + type: object + properties: + criteria: + description: >- + Uses Lucene Query Syntax in the format of + propertyName:value, propertyName:[num1 TO num2] and date + range format: propertyName:[yyyyMMdd TO yyyyMMdd]. In the + response please see the 'docs' element which has the list of + record objects. Each record structure would consist of all + the fields and their corresponding values. + type: string + default: '*:*' + start: + description: Starting record number. Default value is 0. + type: integer + default: 0 + rows: + description: >- + Specify number of rows to be returned. If you run the search + with default values, in the response you will see 'numFound' + attribute which will tell the number of records available in + the dataset. + type: integer + default: 100 + required: + - criteria +components: + schemas: + dataSetList: + type: object + properties: + total: + type: integer + apis: + type: array + items: + type: object + properties: + apiKey: + type: string + description: To be used as a dataset parameter value + apiVersionNumber: + type: string + description: To be used as a version parameter value + apiUrl: + type: string + format: uriref + description: "The URL describing the dataset's fields" + apiDocumentationUrl: + type: string + format: uriref + description: A URL to the API console for each API diff --git a/src/main/resources/APIs/1password.com/events/1.0.0/openapi.yaml b/src/main/resources/APIs/1password.com/events/1.0.0/openapi.yaml new file mode 100644 index 0000000000000000000000000000000000000000..c2965bee3c7de29d6d6c129f6cd916455780cfc9 --- /dev/null +++ b/src/main/resources/APIs/1password.com/events/1.0.0/openapi.yaml @@ -0,0 +1,336 @@ +openapi: 3.0.0 +servers: + - description: 1Password + url: https://events.1password.com + - description: 1Password CA + url: https://events.1password.ca + - description: 1Password EU + url: https://events.1password.eu + - description: 1Password Enterprise + url: https://events.ent.1password.com +info: + description: 1Password Events API Specification. + title: Events API + version: 1.0.0 + x-apisguru-categories: + - security + x-logo: + url: https://upload.wikimedia.org/wikipedia/commons/thumb/e/e3/1password-logo.svg/1280px-1password-logo.svg.png + x-origin: + - format: openapi + url: https://i.1password.com/media/1password-events-reporting/1password-events-api.yaml + version: "3.0" + x-providerName: 1password.com + x-serviceName: events +paths: + /api/auth/introspect: + get: + operationId: getAuthIntrospect + responses: + "200": + $ref: "#/components/responses/IntrospectResponse" + "401": + $ref: "#/components/responses/UnauthorizedErrorResponse" + default: + $ref: "#/components/responses/GenericErrorResponse" + security: + - jwtsa: [] + summary: Performs introspection of the provided Bearer JWT token + tags: + - auth + /api/v1/itemusages: + post: + description: This endpoint requires your JSON Web Token to have the *itemusages* feature. + operationId: getItemUsages + requestBody: + $ref: "#/components/requestBodies/ItemUsagesRequest" + responses: + "200": + $ref: "#/components/responses/ItemUsagesResponse" + "401": + $ref: "#/components/responses/UnauthorizedErrorResponse" + default: + $ref: "#/components/responses/GenericErrorResponse" + security: + - jwtsa: [] + summary: Retrieves item usages + tags: + - api-v1 + /api/v1/signinattempts: + post: + description: This endpoint requires your JSON Web Token to have the *signinattempts* feature. + operationId: getSignInAttempts + requestBody: + $ref: "#/components/requestBodies/SignInAttemptsRequest" + responses: + "200": + $ref: "#/components/responses/SignInAttemptsResponse" + "401": + $ref: "#/components/responses/UnauthorizedErrorResponse" + default: + $ref: "#/components/responses/GenericErrorResponse" + security: + - jwtsa: [] + summary: Retrieves sign-in attempts + tags: + - api-v1 +components: + examples: + Cursor: + summary: Used for continued calling with a cursor + value: + cursor: aGVsbG8hIGlzIGl0IG1lIHlvdSBhcmUgbG9va2luZyBmb3IK + ResetCursor: + summary: Used for reseting the cursor + value: + limit: 100 + start_time: 2021-06-11T16:32:50-03:00 + requestBodies: + CursorRequest: + content: + application/json: + examples: + Continuing cursor: + $ref: "#/components/examples/Cursor" + Resetting cursor: + $ref: "#/components/examples/ResetCursor" + schema: + oneOf: + - $ref: "#/components/schemas/Cursor" + - $ref: "#/components/schemas/ResetCursor" + ItemUsagesRequest: + $ref: "#/components/requestBodies/CursorRequest" + SignInAttemptsRequest: + $ref: "#/components/requestBodies/CursorRequest" + responses: + GenericErrorResponse: + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + description: Generic error + IntrospectResponse: + content: + application/json: + schema: + $ref: "#/components/schemas/Introspection" + description: Introspection object + ItemUsagesResponse: + content: + application/json: + schema: + $ref: "#/components/schemas/ItemUsageItems" + description: Item usages response object + SignInAttemptsResponse: + content: + application/json: + schema: + $ref: "#/components/schemas/SignInAttemptItems" + description: Sign-in attempts response object + UnauthorizedErrorResponse: + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + description: Unauthorized + schemas: + Client: + description: Metadata gathered about the client + properties: + app_name: + example: 1Password Extension + type: string + app_version: + example: "20127" + type: string + ip_address: + example: 13.227.95.22 + type: string + os_name: + example: MacOSX + type: string + os_version: + example: 10.15.6 + type: string + platform_name: + example: Chrome + type: string + platform_version: + description: Depending on the platform used, this can be the version of the browser that the client extension is installed, the model of computer that the native application is installed or the machine's CPU version that the CLI was installed + type: string + Cursor: + description: Cursor + properties: + cursor: + description: Cursor to fetch more data if available or continue the polling process if required + example: aGVsbG8hIGlzIGl0IG1lIHlvdSBhcmUgbG9va2luZyBmb3IK + type: string + CursorCollection: + allOf: + - $ref: "#/components/schemas/Cursor" + - properties: + has_more: + description: Whether there may still be more data to fetch using the returned cursor. If true, the subsequent request could still be empty. + type: boolean + description: Common cursor properties for collection responses + DateTimeRFC3339: + example: 2020-06-11T16:32:50-03:00 + format: date-time + type: string + Details: + description: Additional information about the sign-in attempt + properties: + value: + description: For firewall prevented sign-ins, the value is the chosen continent, country, etc. that blocked the sign-in attempt + example: Europe + type: string + Error: + properties: + Error: + properties: + Message: + description: The error message. + type: string + type: object + type: object + Introspection: + properties: + Features: + example: + - itemusages + - signinattempts + items: + type: string + type: array + IssuedAt: + $ref: "#/components/schemas/DateTimeRFC3339" + UUID: + type: string + type: object + ItemUsage: + description: A single item usage object + properties: + client: + $ref: "#/components/schemas/Client" + item_uuid: + $ref: "#/components/schemas/UUID" + timestamp: + $ref: "#/components/schemas/DateTimeRFC3339" + used_version: + type: integer + user: + $ref: "#/components/schemas/User" + uuid: + $ref: "#/components/schemas/UUID" + vault_uuid: + $ref: "#/components/schemas/UUID" + ItemUsageItems: + allOf: + - properties: + items: + items: + $ref: "#/components/schemas/ItemUsage" + type: array + - $ref: "#/components/schemas/CursorCollection" + description: An object wrapping cursor properties and a list of items usages + ResetCursor: + description: Reset cursor + properties: + end_time: + $ref: "#/components/schemas/DateTimeRFC3339" + limit: + maximum: 1000 + minimum: 1 + type: number + start_time: + $ref: "#/components/schemas/DateTimeRFC3339" + SignInAttempt: + description: A single sign-in attempt object + properties: + category: + enum: + - success + - credentials_failed + - mfa_failed + - modern_version_failed + - firewall_failed + - firewall_reported_success + example: firewall_failed + type: string + client: + $ref: "#/components/schemas/Client" + country: + description: Country ISO Code + example: France + type: string + details: + $ref: "#/components/schemas/Details" + session_uuid: + $ref: "#/components/schemas/UUID" + target_user: + $ref: "#/components/schemas/User" + timestamp: + $ref: "#/components/schemas/DateTimeRFC3339" + type: + enum: + - credentials_ok + - mfa_ok + - password_secret_bad + - mfa_missing + - totp_disabled + - totp_bad + - totp_timeout + - u2f_disabled + - u2f_bad + - u2f_timout + - duo_disabled + - duo_bad + - duo_timeout + - duo_native_bad + - platform_secret_disabled + - platform_secret_bad + - platform_secret_proxy + - code_disabled + - code_bad + - code_timeout + - ip_blocked + - continent_blocked + - country_blocked + - anonymous_blocked + - all_blocked + - modern_version_missing + - modern_version_old + example: continent_blocked + type: string + uuid: + $ref: "#/components/schemas/UUID" + SignInAttemptItems: + allOf: + - properties: + items: + items: + $ref: "#/components/schemas/SignInAttempt" + type: array + - $ref: "#/components/schemas/CursorCollection" + description: An object wrapping cursor properties and a list of sign-in attempts + UUID: + example: 56YE2TYN2VFYRLNSHKPW5NVT5E + type: string + User: + description: User object + properties: + email: + format: email + type: string + name: + description: Full name + example: Jack O'Neill + type: string + uuid: + $ref: "#/components/schemas/UUID" + securitySchemes: + jwtsa: + bearerFormat: JWT-SA + description: A JWT SA token issued to this service + scheme: bearer + type: http diff --git a/src/main/resources/APIs/1password.local/connect/1.3.0/openapi.yaml b/src/main/resources/APIs/1password.local/connect/1.3.0/openapi.yaml new file mode 100644 index 0000000000000000000000000000000000000000..3b5ee953241611ed45e67d5fdeda5c7089850293 --- /dev/null +++ b/src/main/resources/APIs/1password.local/connect/1.3.0/openapi.yaml @@ -0,0 +1,1273 @@ +openapi: 3.0.2 +servers: + - url: http://1password.local + - url: http://localhost:8080/v1 +info: + contact: + email: support@1password.com + name: 1Password Integrations + url: https://support.1password.com/ + description: REST API interface for 1Password Connect. + title: 1Password Connect + version: 1.3.0 + x-apisguru-categories: + - security + x-logo: + url: https://upload.wikimedia.org/wikipedia/commons/thumb/e/e3/1password-logo.svg/1280px-1password-logo.svg.png + x-origin: + - format: openapi + url: https://i.1password.com/media/1password-connect/1password-connect-api.yaml + version: "3.0" + x-providerName: 1password.local + x-serviceName: connect +tags: + - description: Access and manage items inside 1Password Vaults + name: Items + - description: Access 1Password Vaults + name: Vaults + - description: Access API Request Activity + name: Activity +paths: + /activity: + get: + operationId: GetApiActivity + parameters: + - description: How many API Events should be retrieved in a single request. + in: query + name: limit + schema: + default: 50 + example: 10 + type: integer + - description: How far into the collection of API Events should the response start + in: query + name: offset + schema: + default: 0 + example: 50 + type: integer + responses: + "200": + content: + application/json: + schema: + items: + $ref: "#/components/schemas/APIRequest" + type: array + description: OK + headers: + Content-Range: + description: An decription of what part of the collection has been returned as well as the total size. + schema: + example: 1-50/1134 + type: string + "401": + content: + application/json: + example: + message: Invalid token signature + status: 401 + schema: + $ref: "#/components/schemas/ErrorResponse" + description: Invalid or missing token + security: + - ConnectToken: [] + summary: Retrieve a list of API Requests that have been made. + tags: + - Activity + /health: + get: + operationId: GetServerHealth + responses: + "200": + content: + application/json: + examples: + WaitingForAPIRequest: + summary: API server waiting for first authenticated request + value: + dependencies: + - service: sync + status: TOKEN_NEEDED + - message: Connected to./1password.sqlite + service: sqlite + status: ACTIVE + name: 1Password Connect API + version: 1.2.1 + schema: + properties: + dependencies: + items: + $ref: "#/components/schemas/ServiceDependency" + type: array + name: + type: string + version: + description: The Connect server's version + type: string + required: + - name + - version + type: object + description: OK + servers: + - url: http://localhost:8080 + summary: Get state of the server and its dependencies. + tags: + - Health + /heartbeat: + get: + operationId: GetHeartbeat + responses: + "200": + content: + text/plain: + schema: + example: . + type: string + description: OK + servers: + - url: http://localhost:8080 + summary: Ping the server for liveness + tags: + - Health + /metrics: + get: + description: See Prometheus documentation for a complete data model. + operationId: GetPrometheusMetrics + responses: + "200": + content: + text/plain: + schema: + example: | + # HELP go_gc_duration_seconds A summary of the pause duration of garbage collection cycles. + # TYPE go_gc_duration_seconds summary + go_gc_duration_seconds{quantile="0"} 2.9153e-05 + go_gc_duration_seconds{quantile="0.25"} 6.2832e-05 + go_gc_duration_seconds{quantile="0.5"} 9.7187e-05 + go_gc_duration_seconds{quantile="0.75"} 0.000112967 + go_gc_duration_seconds{quantile="1"} 0.000215819 + go_gc_duration_seconds_sum 0.001376862 + go_gc_duration_seconds_count 14 + type: string + description: Successfully returned Prometheus metrics + servers: + - url: http://localhost:8080 + summary: Query server for exposed Prometheus metrics + tags: + - Metrics + /vaults: + get: + operationId: GetVaults + parameters: + - description: Filter the Vault collection based on Vault name using SCIM eq filter + in: query + name: filter + schema: + example: name eq "Some Vault Name" + type: string + responses: + "200": + content: + application/json: + schema: + items: + $ref: "#/components/schemas/Vault" + type: array + description: OK + "401": + content: + application/json: + example: + message: Invalid token signature + status: 401 + schema: + $ref: "#/components/schemas/ErrorResponse" + description: Invalid or missing token + security: + - ConnectToken: [] + summary: Get all Vaults + tags: + - Vaults + "/vaults/{vaultUuid}": + get: + operationId: GetVaultById + parameters: + - description: The UUID of the Vault to fetch Items from + in: path + name: vaultUuid + required: true + schema: + pattern: ^[\da-z]{26}$ + type: string + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/Vault" + description: OK + "401": + content: + application/json: + example: + message: Invalid token signature + status: 401 + schema: + $ref: "#/components/schemas/ErrorResponse" + description: Invalid or missing token + "403": + content: + application/json: + example: + message: vault {vaultUuid} is not in scope + status: 403 + schema: + $ref: "#/components/schemas/ErrorResponse" + description: Unauthorized access + "404": + content: + application/json: + example: + message: vault {itemUuid} not found + status: 404 + schema: + $ref: "#/components/schemas/ErrorResponse" + description: Vault not found + security: + - ConnectToken: [] + summary: Get Vault details and metadata + tags: + - Vaults + "/vaults/{vaultUuid}/items": + get: + operationId: GetVaultItems + parameters: + - description: The UUID of the Vault to fetch Items from + in: path + name: vaultUuid + required: true + schema: + pattern: ^[\da-z]{26}$ + type: string + - description: Filter the Item collection based on Item name using SCIM eq filter + in: query + name: filter + schema: + example: title eq "Some Item Name" + type: string + responses: + "200": + content: + application/json: + schema: + items: + $ref: "#/components/schemas/Item" + type: array + description: OK + "401": + content: + application/json: + example: + message: Invalid token signature + status: 401 + schema: + $ref: "#/components/schemas/ErrorResponse" + description: Invalid or missing token + "404": + content: + application/json: + example: + message: vault {vaultUuid} not found + status: 404 + schema: + $ref: "#/components/schemas/ErrorResponse" + description: Vault not found + security: + - ConnectToken: [] + summary: Get all items for inside a Vault + tags: + - Items + post: + operationId: CreateVaultItem + parameters: + - description: The UUID of the Vault to create an Item in + in: path + name: vaultUuid + required: true + schema: + pattern: ^[\da-z]{26}$ + type: string + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/FullItem" + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/FullItem" + description: OK + "400": + content: + application/json: + example: + message: Invalid item category + status: 400 + schema: + $ref: "#/components/schemas/ErrorResponse" + description: Unable to create item due to invalid input + "401": + content: + application/json: + example: + message: Invalid token signature + status: 401 + schema: + $ref: "#/components/schemas/ErrorResponse" + description: Invalid or missing token + "403": + content: + application/json: + example: + message: vault {vaultUuid} is not in scope + status: 403 + schema: + $ref: "#/components/schemas/ErrorResponse" + description: Unauthorized access + "404": + content: + application/json: + examples: + vaultNotFound: + summary: Vault not found + value: + message: vault {vaultUuid} not found + status: 404 + schema: + $ref: "#/components/schemas/ErrorResponse" + description: Item not found + security: + - ConnectToken: [] + summary: Create a new Item + tags: + - Items + "/vaults/{vaultUuid}/items/{itemUuid}": + delete: + operationId: DeleteVaultItem + parameters: + - description: The UUID of the Vault the item is in + in: path + name: vaultUuid + required: true + schema: + pattern: ^[\da-z]{26}$ + type: string + - description: The UUID of the Item to update + in: path + name: itemUuid + required: true + schema: + pattern: ^[\da-z]{26}$ + type: string + responses: + "204": + description: Successfully deleted an item + "401": + content: + application/json: + example: + message: Invalid token signature + status: 401 + schema: + $ref: "#/components/schemas/ErrorResponse" + description: Invalid or missing token + "403": + content: + application/json: + example: + message: vault {vaultUuid} is not in scope + status: 403 + schema: + $ref: "#/components/schemas/ErrorResponse" + description: Unauthorized access + "404": + content: + application/json: + examples: + vaultNotFound: + summary: Vault not found + value: + message: vault {vaultUuid} not found + status: 404 + schema: + $ref: "#/components/schemas/ErrorResponse" + description: Item not found + security: + - ConnectToken: [] + summary: Delete an Item + tags: + - Items + get: + operationId: GetVaultItemById + parameters: + - description: The UUID of the Vault to fetch Item from + in: path + name: vaultUuid + required: true + schema: + pattern: ^[\da-z]{26}$ + type: string + - description: The UUID of the Item to fetch + in: path + name: itemUuid + required: true + schema: + pattern: ^[\da-z]{26}$ + type: string + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/FullItem" + description: OK + "401": + content: + application/json: + example: + message: Invalid token signature + status: 401 + schema: + $ref: "#/components/schemas/ErrorResponse" + description: Invalid or missing token + "403": + content: + application/json: + example: + message: vault {vaultUuid} is not in scope + status: 403 + schema: + $ref: "#/components/schemas/ErrorResponse" + description: Unauthorized access + "404": + content: + application/json: + examples: + itemNotFound: + summary: Item not found + value: + message: item {itemUuid} not found + status: 404 + vaultNotFound: + summary: Vault not found + value: + message: vault {vaultUuid} not found + status: 404 + schema: + $ref: "#/components/schemas/ErrorResponse" + description: Item not found + security: + - ConnectToken: [] + summary: Get the details of an Item + tags: + - Items + patch: + description: | + Applies a modified [RFC6902 JSON Patch](https://tools.ietf.org/html/rfc6902) document to an Item or ItemField. This endpoint only supports `add`, `remove` and `replace` operations. + + When modifying a specific ItemField, the ItemField's ID in the `path` attribute of the operation object: `/fields/{fieldId}` + operationId: PatchVaultItem + parameters: + - description: The UUID of the Vault the item is in + in: path + name: vaultUuid + required: true + schema: + pattern: ^[\da-z]{26}$ + type: string + - description: The UUID of the Item to update + in: path + name: itemUuid + required: true + schema: + pattern: ^[\da-z]{26}$ + type: string + requestBody: + content: + application/json: + examples: + PatchItemAttr: + summary: Update specific Item attributes + value: + - op: replace + path: /favorite + value: true + - op: remove + path: /tags/1 + PatchItemField: + summary: Add a new ItemField to the Item + value: + - op: add + path: /fields + value: + label: New Field + type: string + value: hunter2 + PatchItemFieldAttr: + summary: Modify a specific ItemField attribute. + value: + - op: add + path: /fields/s2ju540zlna8bdj4uro7sj64rk/label + value: New field name + - op: remove + path: /fields/s2ju540zlna8bdj4uro7sj64rk/value + PatchItemFieldWithID: + summary: Modify or remove an ItemField. + value: + - op: replace + path: /fields/r9qxq7xnhfhukoxsc8ymqr0y11 + value: + label: Replacement Title + type: string + value: new value + - op: remove + path: /fields/h2nl155dshi043yse7wa3u1hs7 + ReplaceAllAttributes: + summary: Replace an entire Item with new fields. Equivalent to a PUT request. + value: + - op: replace + path: / + value: + ...: Any attr from FullItem schema + favorite: true + tags: + - tag1 + - tag2 + title: New Title + schema: + $ref: "#/components/schemas/Patch" + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/FullItem" + description: OK - Item updated. If no Patch operations were provided, Item is unmodified. + "401": + content: + application/json: + example: + message: Invalid token signature + status: 401 + schema: + $ref: "#/components/schemas/ErrorResponse" + description: Invalid or missing token + "403": + content: + application/json: + example: + message: vault {vaultUuid} is not in scope + status: 403 + schema: + $ref: "#/components/schemas/ErrorResponse" + description: Unauthorized access + "404": + content: + application/json: + examples: + itemNotFound: + summary: Item not found + value: + message: item {itemUuid} not found + status: 404 + vaultNotFound: + summary: Vault not found + value: + message: vault {vaultUuid} not found + status: 404 + schema: + $ref: "#/components/schemas/ErrorResponse" + description: Item not found + security: + - ConnectToken: [] + summary: Update a subset of Item attributes + tags: + - Items + put: + operationId: UpdateVaultItem + parameters: + - description: The UUID of the Item's Vault + in: path + name: vaultUuid + required: true + schema: + pattern: ^[\da-z]{26}$ + type: string + - description: The UUID of the Item to update + in: path + name: itemUuid + required: true + schema: + pattern: ^[\da-z]{26}$ + type: string + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/FullItem" + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/FullItem" + description: OK + "400": + content: + application/json: + example: + message: The item doesn't have a {example field name} field. + status: 400 + schema: + $ref: "#/components/schemas/ErrorResponse" + description: Unable to create item due to invalid input + "401": + content: + application/json: + example: + message: Invalid token signature + status: 401 + schema: + $ref: "#/components/schemas/ErrorResponse" + description: Invalid or missing token + "403": + content: + application/json: + example: + message: vault {vaultUuid} is not in scope + status: 403 + schema: + $ref: "#/components/schemas/ErrorResponse" + description: Unauthorized access + "404": + content: + application/json: + examples: + itemNotFound: + summary: Item not found + value: + message: item {itemUuid} not found + status: 404 + vaultNotFound: + summary: Vault not found + value: + message: vault {vaultUuid} not found + status: 404 + schema: + $ref: "#/components/schemas/ErrorResponse" + description: Item not found + security: + - ConnectToken: [] + summary: Update an Item + tags: + - Items + "/vaults/{vaultUuid}/items/{itemUuid}/files": + get: + operationId: GetItemFiles + parameters: + - description: The UUID of the Vault to fetch Items from + in: path + name: vaultUuid + required: true + schema: + format: uuid + type: string + - description: The UUID of the Item to fetch files from + in: path + name: itemUuid + required: true + schema: + format: uuid + type: string + - description: Tells server to return the base64-encoded file contents in the response. + in: query + name: inline_files + schema: + example: true + type: boolean + responses: + "200": + content: + application/json: + schema: + items: + $ref: "#/components/schemas/File" + type: array + description: OK + "401": + content: + application/json: + example: + message: Invalid token signature + status: 401 + schema: + $ref: "#/components/schemas/ErrorResponse" + description: Invalid or missing token + "404": + content: + application/json: + examples: + itemNotFound: + summary: Item not found + value: + message: item {itemUuid} not found + status: 404 + vaultNotFound: + summary: Vault not found + value: + message: vault {vaultUuid} not found + status: 404 + schema: + $ref: "#/components/schemas/ErrorResponse" + description: Item not found + "413": + content: + application/json: + examples: + fileTooLarge: + summary: File too large + value: + message: File is too large to inline in request. Use the /v1/vaults/{vaultUUID}/items/{itemUUID}/files/{fileUUID}/content endpoint instead. + status: 413 + schema: + $ref: "#/components/schemas/ErrorResponse" + description: File content too large to display + security: + - ConnectToken: [] + summary: Get all the files inside an Item + tags: + - Files + "/vaults/{vaultUuid}/items/{itemUuid}/files/{fileUuid}": + get: + operationId: GetDetailsOfFileById + parameters: + - description: The UUID of the Vault to fetch Item from + in: path + name: vaultUuid + required: true + schema: + format: uuid + type: string + - description: The UUID of the Item to fetch File from + in: path + name: itemUuid + required: true + schema: + format: uuid + type: string + - description: The UUID of the File to fetch + in: path + name: fileUuid + required: true + schema: + format: uuid + type: string + - description: Tells server to return the base64-encoded file contents in the response. + in: query + name: inline_files + schema: + example: true + type: boolean + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/File" + description: OK + "401": + content: + application/json: + example: + message: Invalid token signature + status: 401 + schema: + $ref: "#/components/schemas/ErrorResponse" + description: Invalid or missing token + "403": + content: + application/json: + example: + message: vault {vaultUuid} is not in scope + status: 403 + schema: + $ref: "#/components/schemas/ErrorResponse" + description: Unauthorized access + "404": + content: + application/json: + examples: + fileNotFound: + summary: File not found + value: + message: file {fileUuid} not found + status: 404 + itemNotFound: + summary: Item not found + value: + message: item {itemUuid} not found + status: 404 + vaultNotFound: + summary: Vault not found + value: + message: vault {vaultUuid} not found + status: 404 + schema: + $ref: "#/components/schemas/ErrorResponse" + description: File not found + "413": + content: + application/json: + examples: + fileTooLarge: + summary: File too large + value: + message: File is too large to inline in request. Use the /v1/vaults/{vaultUUID}/items/{itemUUID}/files/{fileUUID}/content endpoint instead. + status: 413 + schema: + $ref: "#/components/schemas/ErrorResponse" + description: File content too large to display + security: + - ConnectToken: [] + summary: Get the details of a File + tags: + - Files + "/vaults/{vaultUuid}/items/{itemUuid}/files/{fileUuid}/content": + get: + operationId: DownloadFileByID + responses: + "200": + content: + application/octet-stream: + schema: + format: binary + type: string + description: Success + headers: + Content-Disposition: + schema: + example: attachment; filename="privkey.pem" + type: string + Content-Length: + schema: + example: "6432" + type: string + "401": + content: + application/json: + example: + message: Invalid token signature + status: 401 + schema: + $ref: "#/components/schemas/ErrorResponse" + description: Invalid or missing token + "404": + content: + application/json: + examples: + fileNotFound: + summary: File not found + value: + message: file {fileUuid} not found + status: 404 + itemNotFound: + summary: Item not found + value: + message: item {itemUuid} not found + status: 404 + vaultNotFound: + summary: Vault not found + value: + message: vault {vaultUuid} not found + status: 404 + schema: + $ref: "#/components/schemas/ErrorResponse" + description: File not found + security: + - ConnectToken: [] + summary: Get the content of a File + tags: + - Files + parameters: + - description: The UUID of the Vault the item is in + in: path + name: vaultUuid + required: true + schema: + format: uuid + type: string + - description: The UUID of the Item the File is in + in: path + name: itemUuid + required: true + schema: + format: uuid + type: string + - description: UUID of the file to get content from + in: path + name: fileUuid + required: true + schema: + type: string +components: + schemas: + APIRequest: + description: Represents a request that was made to the API. Including what Token was used and what resource was accessed. + properties: + action: + enum: + - READ + - CREATE + - UPDATE + - DELETE + type: string + actor: + properties: + account: + type: string + id: + format: uuid + type: string + jti: + type: string + requestIp: + type: string + userAgent: + type: string + type: object + requestId: + description: The unique id used to identify a single request. + format: uuid + type: string + resource: + properties: + item: + properties: + id: + pattern: ^[\da-z]{26}$ + type: string + type: object + itemVersion: + type: integer + type: + enum: + - ITEM + - VAULT + type: string + vault: + properties: + id: + pattern: ^[\da-z]{26}$ + type: string + type: object + type: object + result: + enum: + - SUCCESS + - DENY + type: string + timestamp: + description: The time at which the request was processed by the server. + format: date-time + readOnly: true + type: string + type: object + ErrorResponse: + properties: + message: + description: A message detailing the error + type: string + status: + description: HTTP Status Code + type: integer + type: object + Field: + properties: + entropy: + description: For fields with a purpose of `PASSWORD` this is the entropy of the value + readOnly: true + type: number + generate: + default: false + description: If value is not present then a new value should be generated for this field + type: boolean + id: + type: string + label: + type: string + purpose: + description: Some item types, Login and Password, have fields used for autofill. This property indicates that purpose and is required for some item types. + enum: + - "" + - USERNAME + - PASSWORD + - NOTES + type: string + recipe: + $ref: "#/components/schemas/GeneratorRecipe" + section: + properties: + id: + type: string + type: object + type: + default: STRING + enum: + - STRING + - EMAIL + - CONCEALED + - URL + - TOTP + - DATE + - MONTH_YEAR + - MENU + type: string + value: + type: string + required: + - id + - type + type: object + File: + example: + content: VGhlIGZ1dHVyZSBiZWxvbmdzIHRvIHRoZSBjdXJpb3VzLgo= + content_path: v1/vaults/ionaiwtdvgclrixbt6ztpqcxnq/items/p7eflcy7f5mk7vg6zrzf5rjjyu/files/6r65pjq33banznomn7q22sj44e/content + id: 6r65pjq33banznomn7q22sj44e + name: foo.txt + size: 35 + properties: + content: + description: Base64-encoded contents of the file. Only set if size <= OP_MAX_INLINE_FILE_SIZE_KB kb and `inline_files` is set to `true`. + format: byte + type: string + content_path: + description: Path of the Connect API that can be used to download the contents of this file. + readOnly: true + type: string + id: + description: ID of the file + type: string + name: + description: Name of the file + type: string + section: + description: For files that are in a section, this field describes the section. + properties: + id: + type: string + type: object + size: + description: Size in bytes of the file + type: integer + type: object + FullItem: + allOf: + - $ref: "#/components/schemas/Item" + - properties: + fields: + items: + $ref: "#/components/schemas/Field" + type: array + files: + items: + $ref: "#/components/schemas/File" + type: array + sections: + items: + properties: + id: + type: string + label: + type: string + type: object + type: array + type: object + GeneratorRecipe: + description: The recipe is used in conjunction with the "generate" property to set the character set used to generate a new secure value + properties: + characterSets: + items: + enum: + - LETTERS + - DIGITS + - SYMBOLS + type: string + maximum: 3 + minimum: 0 + type: array + uniqueItems: true + length: + default: 32 + description: Length of the generated value + maximum: 64 + minimum: 1 + type: integer + type: object + Item: + properties: + category: + enum: + - LOGIN + - PASSWORD + - API_CREDENTIAL + - SERVER + - DATABASE + - CREDIT_CARD + - MEMBERSHIP + - PASSPORT + - SOFTWARE_LICENSE + - OUTDOOR_LICENSE + - SECURE_NOTE + - WIRELESS_ROUTER + - BANK_ACCOUNT + - DRIVER_LICENSE + - IDENTITY + - REWARD_PROGRAM + - DOCUMENT + - EMAIL_ACCOUNT + - SOCIAL_SECURITY_NUMBER + - CUSTOM + type: string + createdAt: + format: date-time + readOnly: true + type: string + favorite: + default: false + type: boolean + id: + pattern: ^[\da-z]{26}$ + type: string + lastEditedBy: + readOnly: true + type: string + state: + enum: + - ARCHIVED + - DELETED + readOnly: true + type: string + tags: + items: + type: string + type: array + title: + type: string + updatedAt: + format: date-time + readOnly: true + type: string + urls: + example: + - href: https://example.com + primary: true + - href: https://example.org + items: + properties: + href: + format: url + type: string + primary: + type: boolean + required: + - href + type: object + type: array + vault: + properties: + id: + pattern: ^[\da-z]{26}$ + type: string + required: + - id + type: object + version: + type: integer + required: + - vault + - category + type: object + Patch: + items: + properties: + op: + enum: + - add + - remove + - replace + type: string + path: + description: An RFC6901 JSON Pointer pointing to the Item document, an Item Attribute, and Item Field by Field ID, or an Item Field Attribute + example: /fields/06gnn2b95example10q91512p5/label + type: string + value: + type: object + required: + - op + - path + type: object + type: array + ServiceDependency: + description: The state of a registered server dependency. + properties: + message: + description: Human-readable message for explaining the current state. + type: string + service: + type: string + status: + type: string + type: object + Vault: + properties: + attributeVersion: + description: The vault version + type: integer + contentVersion: + description: The version of the vault contents + type: integer + createdAt: + format: date-time + readOnly: true + type: string + description: + type: string + id: + pattern: ^[\da-z]{26}$ + type: string + items: + description: Number of active items in the vault + type: integer + name: + type: string + type: + enum: + - USER_CREATED + - PERSONAL + - EVERYONE + - TRANSFER + type: string + updatedAt: + format: date-time + readOnly: true + type: string + type: object + securitySchemes: + ConnectToken: + bearerFormat: JWT + scheme: bearer + type: http diff --git a/src/main/resources/APIs/6-dot-authentiqio.appspot.com/6/openapi.yaml b/src/main/resources/APIs/6-dot-authentiqio.appspot.com/6/openapi.yaml new file mode 100644 index 0000000000000000000000000000000000000000..9f349fe63416c78c58790fa16b39652890537834 --- /dev/null +++ b/src/main/resources/APIs/6-dot-authentiqio.appspot.com/6/openapi.yaml @@ -0,0 +1,671 @@ +openapi: 3.0.0 +servers: + - url: https://6-dot-authentiqio.appspot.com +info: + contact: + email: hello@authentiq.com + name: Authentiq team + url: http://authentiq.io/support + description: Strong authentication, without the passwords. + license: + name: Apache 2.0 + url: http://www.apache.org/licenses/LICENSE-2.0.html + termsOfService: http://authentiq.com/terms/ + title: Authentiq API + version: "6" + x-apisguru-categories: + - security + x-logo: + backgroundColor: "#F26641" + url: https://www.authentiq.com/theme/images/authentiq-logo-a-inverse.svg + x-origin: + - format: openapi + url: https://raw.githubusercontent.com/AuthentiqID/authentiq-docs/master/docs/swagger/issuer.yaml + version: "3.0" + x-providerName: 6-dot-authentiqio.appspot.com +paths: + /key: + delete: + description: | + Revoke an Authentiq ID using email & phone. + + If called with `email` and `phone` only, a verification code + will be sent by email. Do a second call adding `code` to + complete the revocation. + operationId: key_revoke_nosecret + parameters: + - description: primary email associated to Key (ID) + in: query + name: email + required: true + schema: + type: string + - description: primary phone number, international representation + in: query + name: phone + required: true + schema: + type: string + - description: verification code sent by email + in: query + name: code + required: false + schema: + type: string + responses: + "200": + content: + application/json: + schema: + properties: + status: + description: pending or done + type: string + type: object + description: Successfully deleted + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + description: Authentication error `auth-error` + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + description: Unknown key `unknown-key` + "409": + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + description: Confirm with code sent `confirm-first` + default: + $ref: "#/components/responses/ErrorResponse" + tags: + - key + - delete + post: + description: | + Register a new ID `JWT(sub, devtoken)` + + v5: `JWT(sub, pk, devtoken, ...)` + + See: https://github.com/skion/authentiq/wiki/JWT-Examples + operationId: key_register + requestBody: + $ref: "#/components/requestBodies/AuthentiqID" + responses: + "201": + content: + application/json: + schema: + properties: + secret: + description: revoke key + type: string + status: + description: registered + type: string + type: object + description: Successfully registered + "409": + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + description: Key already registered `duplicate-key` + default: + $ref: "#/components/responses/ErrorResponse" + tags: + - key + - post + "/key/{PK}": + delete: + description: Revoke an Identity (Key) with a revocation secret + operationId: key_revoke + parameters: + - $ref: "#/components/parameters/PK" + - description: revokation secret + in: query + name: secret + required: true + schema: + type: string + responses: + "200": + content: + application/json: + schema: + properties: + status: + description: done + type: string + type: object + description: Successful response + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + description: Key not found / wrong code `auth-error` + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + description: Unknown key `unknown-key` + default: + $ref: "#/components/responses/ErrorResponse" + tags: + - key + - delete + get: + description: | + Get public details of an Authentiq ID. + operationId: key_retrieve + parameters: + - $ref: "#/components/parameters/PK" + responses: + "200": + content: + application/json: + schema: + properties: + since: + format: date-time + type: string + status: + type: string + sub: + description: base64safe encoded public signing key + type: string + title: JWT + type: object + description: Successfully retrieved + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + description: Unknown key `unknown-key` + "410": + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + description: Key is revoked (gone). `revoked-key` + default: + $ref: "#/components/responses/ErrorResponse" + tags: + - key + - get + head: + description: | + HEAD info on Authentiq ID + parameters: + - $ref: "#/components/parameters/PK" + responses: + "200": + description: Key exists + "404": + content: + "*/*": + schema: + $ref: "#/components/schemas/Error" + description: Unknown key `unknown-key` + "410": + content: + "*/*": + schema: + $ref: "#/components/schemas/Error" + description: Key is revoked `revoked-key` + default: + $ref: "#/components/responses/ErrorResponse" + tags: + - key + - head + post: + description: | + update properties of an Authentiq ID. + (not operational in v4; use PUT for now) + + v5: POST issuer-signed email & phone scopes in + a self-signed JWT + + See: https://github.com/skion/authentiq/wiki/JWT-Examples + operationId: key_update + parameters: + - $ref: "#/components/parameters/PK" + requestBody: + $ref: "#/components/requestBodies/AuthentiqID" + responses: + "200": + content: + application/json: + schema: + properties: + status: + description: confirmed + type: string + type: object + description: Successfully updated + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + description: Unknown key `unknown-key` + default: + $ref: "#/components/responses/ErrorResponse" + tags: + - key + - post + put: + description: | + Update Authentiq ID by replacing the object. + + v4: `JWT(sub,email,phone)` to bind email/phone hash; + + v5: POST issuer-signed email & phone scopes + and PUT to update registration `JWT(sub, pk, devtoken, ...)` + + See: https://github.com/skion/authentiq/wiki/JWT-Examples + operationId: key_bind + parameters: + - $ref: "#/components/parameters/PK" + requestBody: + $ref: "#/components/requestBodies/AuthentiqID" + responses: + "200": + content: + application/json: + schema: + properties: + status: + description: confirmed + type: string + type: object + description: Successfully updated + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + description: Unknown key `unknown-key` + "409": + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + description: Already bound to another key `duplicate-hash` + default: + $ref: "#/components/responses/ErrorResponse" + tags: + - key + - put + /login: + post: + description: | + push sign-in request + See: https://github.com/skion/authentiq/wiki/JWT-Examples + operationId: push_login_request + parameters: + - description: URI App will connect to + in: query + name: callback + required: true + schema: + type: string + requestBody: + content: + application/jwt: + schema: + $ref: "#/components/schemas/PushToken" + description: Push Token. + required: true + responses: + "200": + content: + application/json: + schema: + properties: + status: + description: sent + type: string + type: object + description: Successful response + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + description: Unauthorized for this callback audience `aud-error` or JWT should be self-signed `auth-error` + default: + $ref: "#/components/responses/ErrorResponse" + tags: + - login + - post + /scope: + post: + description: | + scope verification request + See: https://github.com/skion/authentiq/wiki/JWT-Examples + operationId: sign_request + parameters: + - description: test only mode, using test issuer + in: query + name: test + required: false + schema: + type: integer + requestBody: + content: + application/jwt: + schema: + $ref: "#/components/schemas/Claims" + description: Claims of scope + required: true + responses: + "201": + content: + application/json: + schema: + properties: + job: + description: 20-character ID + type: string + status: + description: waiting + type: string + type: object + description: Successful response + "429": + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + description: Too Many Requests on same address / number `rate-limit` + default: + $ref: "#/components/responses/ErrorResponse" + tags: + - scope + - post + "/scope/{job}": + delete: + description: delete a verification job + operationId: sign_delete + parameters: + - $ref: "#/components/parameters/JobID" + responses: + "200": + content: + application/json: + schema: + properties: + status: + description: done + type: string + type: object + description: Successfully deleted + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + description: Job not found `unknown-job` + default: + $ref: "#/components/responses/ErrorResponse" + tags: + - scope + - delete + get: + description: get the status / current content of a verification job + operationId: sign_retrieve + parameters: + - $ref: "#/components/parameters/JobID" + responses: + "200": + content: + application/json: + schema: + properties: + exp: + type: integer + field: + type: string + sub: + description: base64safe encoded public signing key + type: string + title: JWT + type: object + application/jwt: + schema: + properties: + exp: + type: integer + field: + type: string + sub: + description: base64safe encoded public signing key + type: string + title: JWT + type: object + description: Successful response (JWT) + "204": + description: Confirmed, waiting for signing + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + application/jwt: + schema: + $ref: "#/components/schemas/Error" + description: Job not found `unknown-job` + default: + $ref: "#/components/responses/ErrorResponse" + tags: + - scope + - get + head: + description: HEAD to get the status of a verification job + operationId: sign_retrieve_head + parameters: + - $ref: "#/components/parameters/JobID" + responses: + "200": + description: Confirmed and signed + "204": + description: Confirmed, waiting for signing + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + description: Job not found `unknown-job` + default: + $ref: "#/components/responses/ErrorResponse" + tags: + - scope + - head + post: + description: this is a scope confirmation + operationId: sign_confirm + parameters: + - $ref: "#/components/parameters/JobID" + responses: + "202": + content: + application/json: + schema: + properties: + status: + description: confirmed + type: string + type: object + description: Successfully confirmed + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + description: Confirmation error `auth-error` + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + description: Job not found `unknown-job` + "405": + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + description: JWT POSTed to scope `not-supported` + default: + $ref: "#/components/responses/ErrorResponse" + tags: + - scope + - post + put: + description: | + authority updates a JWT with its signature + See: https://github.com/skion/authentiq/wiki/JWT-Examples + operationId: sign_update + parameters: + - $ref: "#/components/parameters/JobID" + responses: + "200": + content: + application/jwt: + schema: + properties: + jwt: + description: result is JWT or JSON?? + type: string + status: + description: ready + type: string + type: object + description: Successfully updated + "404": + content: + application/jwt: + schema: + $ref: "#/components/schemas/Error" + description: Job not found `unknown-job` + "409": + content: + application/jwt: + schema: + $ref: "#/components/schemas/Error" + description: Job not confirmed yet `confirm-first` + default: + $ref: "#/components/responses/ErrorResponse" + tags: + - scope + - put +components: + parameters: + JobID: + description: Job ID (20 chars) + in: path + name: job + required: true + schema: + type: string + PK: + description: Public Signing Key - Authentiq ID (43 chars) + in: path + name: PK + required: true + schema: + type: string + requestBodies: + AuthentiqID: + content: + application/jwt: + schema: + $ref: "#/components/schemas/AuthentiqID" + description: Authentiq ID to register + required: true + responses: + ErrorResponse: + content: + "*/*": + schema: + $ref: "#/components/schemas/Error" + description: Error response + schemas: + AuthentiqID: + description: | + Authentiq ID in JWT format, self-signed. + properties: + devtoken: + description: device token for push messages + type: string + sub: + description: UUID and public signing key + type: string + required: + - sub + Claims: + description: | + Claim in JWT format, self- or issuer-signed. + properties: + email: + description: "" + type: string + phone: + description: "" + type: string + scope: + description: claim scope + type: string + sub: + description: UUID + type: string + type: + description: "" + type: string + required: + - sub + - scope + Error: + properties: + detail: + type: string + error: + type: integer + title: + type: string + type: + description: unique uri for this error + type: string + required: + - error + PushToken: + description: | + PushToken in JWT format, self-signed. + properties: + aud: + description: audience (URI) + type: string + exp: + type: integer + iat: + type: integer + iss: + description: issuer (URI) + type: string + nbf: + type: integer + sub: + description: UUID and public signing key + type: string + required: + - sub + - iss + - aud diff --git a/src/main/resources/APIs/ably.io/platform/1.1.0/openapi.yaml b/src/main/resources/APIs/ably.io/platform/1.1.0/openapi.yaml new file mode 100644 index 0000000000000000000000000000000000000000..1ae6e28aa05da9f2eb4780719fe74f584603c9e1 --- /dev/null +++ b/src/main/resources/APIs/ably.io/platform/1.1.0/openapi.yaml @@ -0,0 +1,1274 @@ +openapi: 3.0.1 +servers: + - url: https://rest.ably.io +info: + contact: + email: support@ably.io + name: Ably Support + url: https://www.ably.io/contact + x-twitter: ablyrealtime + description: The [REST API specification](https://www.ably.io/documentation/rest-api) for Ably. + title: Platform API + version: 1.1.0 + x-apisguru-categories: + - cloud + x-logo: + url: https://twitter.com/ablyrealtime/profile_image?size=original + x-origin: + - format: openapi + url: https://raw.githubusercontent.com/ably/open-specs/main/definitions/platform-v1.yaml + version: "3.0" + x-providerName: ably.io + x-serviceName: platform +security: + - basicAuth: [] + - bearerAuth: [] +paths: + /channels: + get: + description: Enumerate all active channels of the application + operationId: getMetadataOfAllChannels + parameters: + - in: query + name: limit + schema: + default: 100 + type: integer + - description: Optionally limits the query to only those channels whose name starts with the given prefix + in: query + name: prefix + schema: + type: string + - description: optionally specifies whether to return just channel names (by=id) or ChannelDetails (by=value) + in: query + name: by + schema: + enum: + - value + - id + type: string + responses: + 2XX: + content: + application/json: + schema: + oneOf: + - items: + $ref: "#/components/schemas/ChannelDetails" + type: array + - items: + type: string + type: array + application/x-msgpack: + schema: + oneOf: + - items: + $ref: "#/components/schemas/ChannelDetails" + type: array + - items: + type: string + type: array + text/html: + schema: + type: string + description: OK + headers: + link: + $ref: "#/components/headers/Link" + default: + $ref: "#/components/responses/Error" + summary: Enumerate all active channels of the application + tags: + - Status + parameters: + - $ref: "#/components/parameters/versionHeader" + - $ref: "#/components/parameters/responseFormat" + "/channels/{channel_id}": + get: + description: Get metadata of a channel + operationId: getMetadataOfChannel + parameters: + - $ref: "#/components/parameters/channelId" + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/ChannelDetails" + description: OK + headers: + x-ably-serverid: + $ref: "#/components/headers/ServerId" + default: + $ref: "#/components/responses/Error" + summary: Get metadata of a channel + tags: + - Status + parameters: + - $ref: "#/components/parameters/versionHeader" + - $ref: "#/components/parameters/responseFormat" + "/channels/{channel_id}/messages": + get: + description: Get message history for a channel + operationId: getMessagesByChannel + parameters: + - $ref: "#/components/parameters/channelId" + - $ref: "#/components/parameters/filterStart" + - $ref: "#/components/parameters/filterLimit" + - $ref: "#/components/parameters/filterEnd" + - $ref: "#/components/parameters/filterDirection" + responses: + 2XX: + content: + application/json: + schema: + items: + $ref: "#/components/schemas/Message" + type: array + application/x-msgpack: + schema: + items: + $ref: "#/components/schemas/Message" + type: array + text/html: + schema: + type: string + description: OK + headers: + link: + $ref: "#/components/headers/Link" + x-ably-serverid: + $ref: "#/components/headers/ServerId" + default: + description: Error + headers: + x-ably-errorcode: + $ref: "#/components/headers/ErrorCode" + x-ably-errormessage: + $ref: "#/components/headers/ErrorMessage" + x-ably-serverid: + $ref: "#/components/headers/ServerId" + summary: Get message history for a channel + tags: + - History + parameters: + - $ref: "#/components/parameters/versionHeader" + - $ref: "#/components/parameters/responseFormat" + post: + description: Publish a message to the specified channel + operationId: publishMessagesToChannel + parameters: + - $ref: "#/components/parameters/channelId" + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/Message" + application/x-msgpack: + schema: + $ref: "#/components/schemas/Message" + application/x-www-form-urlencoded: + schema: + $ref: "#/components/schemas/Message" + responses: + 2XX: + content: + application/json: + schema: + properties: + channel: + type: string + messageId: + type: string + type: object + application/x-msgpack: + schema: + properties: + channel: + type: string + messageId: + type: string + type: object + text/html: + schema: + properties: + channel: + type: string + messageId: + type: string + type: object + description: OK + headers: + x-ably-serverid: + $ref: "#/components/headers/ServerId" + default: + $ref: "#/components/responses/Error" + summary: Publish a message to a channel + tags: + - Publishing + "/channels/{channel_id}/presence": + get: + description: Get presence on a channel + operationId: getPresenceOfChannel + parameters: + - $ref: "#/components/parameters/channelId" + - in: query + name: clientId + schema: + type: string + - in: query + name: connectionId + schema: + type: string + - in: query + name: limit + schema: + default: 100 + type: integer + responses: + "200": + content: + application/json: + schema: + items: + $ref: "#/components/schemas/PresenceMessage" + type: array + application/x-msgpack: + schema: + items: + $ref: "#/components/schemas/PresenceMessage" + type: array + text/html: + schema: + type: string + description: OK + headers: + link: + $ref: "#/components/headers/Link" + x-ably-serverid: + $ref: "#/components/headers/ServerId" + default: + $ref: "#/components/responses/Error" + summary: Get presence of a channel + tags: + - Status + parameters: + - $ref: "#/components/parameters/versionHeader" + - $ref: "#/components/parameters/responseFormat" + "/channels/{channel_id}/presence/history": + get: + description: Get presence on a channel + operationId: getPresenceHistoryOfChannel + parameters: + - $ref: "#/components/parameters/channelId" + - $ref: "#/components/parameters/filterStart" + - $ref: "#/components/parameters/filterLimit" + - $ref: "#/components/parameters/filterEnd" + - $ref: "#/components/parameters/filterDirection" + responses: + 2XX: + content: + application/json: + schema: + items: + $ref: "#/components/schemas/PresenceMessage" + type: array + application/x-msgpack: + schema: + items: + $ref: "#/components/schemas/PresenceMessage" + type: array + text/html: + schema: + type: string + description: OK + headers: + link: + $ref: "#/components/headers/Link" + default: + $ref: "#/components/responses/Error" + summary: Get presence history of a channel + tags: + - History + parameters: + - $ref: "#/components/parameters/versionHeader" + - $ref: "#/components/parameters/responseFormat" + "/keys/{keyName}/requestToken": + parameters: + - $ref: "#/components/parameters/versionHeader" + - $ref: "#/components/parameters/responseFormat" + post: + description: This is the means by which clients obtain access tokens to use the service. You can see how to construct an Ably TokenRequest in the [Ably TokenRequest spec](https://www.ably.io/documentation/rest-api/token-request-spec) documentation, although we recommend you use an Ably SDK rather to create a TokenRequest, as the construction of a TokenRequest is complex. The resulting token response object contains the token properties as defined in Ably TokenRequest spec. Authentication is not required if using a Signed TokenRequest. + operationId: requestAccessToken + parameters: + - $ref: "#/components/parameters/key_name" + requestBody: + content: + application/json: + example: + capability: + channel1: + - publish + - subscribe + wildcard:channels:*: + - publish + keyName: YourKey.Name + timestamp: "1559124196551" + schema: + oneOf: + - $ref: "#/components/schemas/TokenRequest" + - $ref: "#/components/schemas/SignedTokenRequest" + responses: + 2XX: + content: + application/json: + schema: + $ref: "#/components/schemas/TokenDetails" + application/x-msgpack: + schema: + $ref: "#/components/schemas/TokenDetails" + description: OK + default: + $ref: "#/components/responses/Error" + summary: Request an access token + tags: + - Authentication + /push/channelSubscriptions: + delete: + description: Delete a device details object. + operationId: deletePushDeviceDetails + parameters: + - description: Filter to restrict to subscriptions associated with that channel. + in: query + name: channel + schema: + type: string + - description: Must be set when clientId is empty, cannot be used with clientId. + in: query + name: deviceId + schema: + type: string + - description: Must be set when deviceId is empty, cannot be used with deviceId. + in: query + name: clientId + schema: + type: string + responses: + 2XX: + description: OK + default: + $ref: "#/components/responses/Error" + summary: Delete a registered device's update token + tags: + - Push + get: + description: Get a list of push notification subscriptions to channels. + operationId: getPushSubscriptionsOnChannels + parameters: + - description: Filter to restrict to subscriptions associated with that channel. + in: query + name: channel + schema: + type: string + - description: Optional filter to restrict to devices associated with that deviceId. Cannot be used with clientId. + in: query + name: deviceId + schema: + type: string + - description: Optional filter to restrict to devices associated with that clientId. Cannot be used with deviceId. + in: query + name: clientId + schema: + type: string + - description: The maximum number of records to return. + in: query + name: limit + schema: + default: 100 + maximum: 1000 + type: integer + responses: + 2XX: + content: + application/json: + schema: + $ref: "#/components/schemas/DeviceDetails" + description: OK + default: + $ref: "#/components/responses/Error" + summary: List channel subscriptions + tags: + - Push + parameters: + - $ref: "#/components/parameters/versionHeader" + - $ref: "#/components/parameters/responseFormat" + post: + description: Subscribe either a single device or all devices associated with a client ID to receive push notifications from messages sent to a channel. + operationId: subscribePushDeviceToChannel + requestBody: + content: + application/json: + example: + channel: my:channel + clientId: myClientId + schema: + oneOf: + - properties: + channel: + description: Channel name. + type: string + deviceId: + description: Must be set when clientId is empty, cannot be used with clientId. + type: string + type: object + - properties: + channel: + description: Channel name. + type: string + clientId: + description: Must be set when deviceId is empty, cannot be used with deviceId. + type: string + type: object + application/x-msgpack: + example: + channel: my:channel + clientId: myClientId + schema: + oneOf: + - properties: + channel: + description: Channel name. + type: string + deviceId: + description: Must be set when clientId is empty, cannot be used with clientId. + type: string + type: object + - properties: + channel: + description: Channel name. + type: string + clientId: + description: Must be set when deviceId is empty, cannot be used with deviceId. + type: string + type: object + application/x-www-form-urlencoded: + example: + channel: my:channel + clientId: myClientId + schema: + oneOf: + - properties: + channel: + description: Channel name. + type: string + deviceId: + description: Must be set when clientId is empty, cannot be used with clientId. + type: string + type: object + - properties: + channel: + description: Channel name. + type: string + clientId: + description: Must be set when deviceId is empty, cannot be used with deviceId. + type: string + type: object + responses: + 2XX: + description: OK + default: + $ref: "#/components/responses/Error" + summary: Subscribe a device to a channel + tags: + - Push + /push/channels: + get: + description: Returns a paginated response of channel names. + operationId: getChannelsWithPushSubscribers + responses: + 2XX: + content: + application/json: + schema: + items: + type: string + type: array + application/x-msgpack: + schema: + items: + type: string + type: array + text/html: + schema: + items: + type: string + type: array + description: OK + default: + $ref: "#/components/responses/Error" + summary: List all channels with at least one subscribed device + tags: + - Push + parameters: + - $ref: "#/components/parameters/versionHeader" + - $ref: "#/components/parameters/responseFormat" + /push/deviceRegistrations: + delete: + description: Unregisters devices. All their subscriptions for receiving push notifications through channels will also be deleted. + operationId: unregisterAllPushDevices + parameters: + - description: Optional filter to restrict to devices associated with that deviceId. Cannot be used with clientId. + in: query + name: deviceId + schema: + type: string + - description: Optional filter to restrict to devices associated with that clientId. Cannot be used with deviceId. + in: query + name: clientId + schema: + type: string + responses: + 2XX: + description: OK + default: + $ref: "#/components/responses/Error" + summary: Unregister matching devices for push notifications + tags: + - Push + get: + description: List of device details of devices registed for push notifications. + operationId: getRegisteredPushDevices + parameters: + - description: Optional filter to restrict to devices associated with that deviceId. + in: query + name: deviceId + schema: + type: string + - description: Optional filter to restrict to devices associated with that clientId. + in: query + name: clientId + schema: + type: string + - description: The maximum number of records to return. + in: query + name: limit + schema: + default: 100 + maximum: 1000 + type: integer + responses: + 2XX: + content: + application/json: + schema: + $ref: "#/components/schemas/DeviceDetails" + application/x-msgpack: + schema: + $ref: "#/components/schemas/DeviceDetails" + text/html: + schema: + $ref: "#/components/schemas/DeviceDetails" + description: OK + default: + $ref: "#/components/responses/Error" + summary: List devices registered for receiving push notifications + tags: + - Push + parameters: + - $ref: "#/components/parameters/versionHeader" + - $ref: "#/components/parameters/responseFormat" + post: + description: Register a device’s details, including the information necessary to deliver push notifications to it. Requires "push-admin" capability. + operationId: registerPushDevice + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/DeviceDetails" + application/x-msgpack: + schema: + $ref: "#/components/schemas/DeviceDetails" + responses: + 2XX: + content: + application/json: + schema: + $ref: "#/components/schemas/DeviceDetails" + application/x-msgpack: + schema: + $ref: "#/components/schemas/DeviceDetails" + text/html: + schema: + $ref: "#/components/schemas/DeviceDetails" + description: OK + default: + $ref: "#/components/responses/Error" + summary: Register a device for receiving push notifications + tags: + - Push + "/push/deviceRegistrations/{device_id}": + delete: + description: Unregisters a single device by its device ID. All its subscriptions for receiving push notifications through channels will also be deleted. + operationId: unregisterPushDevice + parameters: + - $ref: "#/components/parameters/deviceId" + responses: + 2XX: + description: OK + default: + $ref: "#/components/responses/Error" + summary: Unregister a single device for push notifications + tags: + - Push + get: + description: Get the full details of a device. + operationId: getPushDeviceDetails + parameters: + - $ref: "#/components/parameters/deviceId" + responses: + 2XX: + content: + application/json: + schema: + $ref: "#/components/schemas/DeviceDetails" + application/x-msgpack: + schema: + $ref: "#/components/schemas/DeviceDetails" + text/html: + schema: + $ref: "#/components/schemas/DeviceDetails" + description: OK + default: + $ref: "#/components/responses/Error" + summary: Get a device registration + tags: + - Push + parameters: + - $ref: "#/components/parameters/versionHeader" + - $ref: "#/components/parameters/responseFormat" + patch: + description: Specific attributes of an existing registration can be updated. Only clientId, metadata and push.recipient are mutable. + operationId: patchPushDeviceDetails + parameters: + - $ref: "#/components/parameters/deviceId" + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/DeviceDetails" + application/x-msgpack: + schema: + $ref: "#/components/schemas/DeviceDetails" + application/x-www-form-urlencoded: + schema: + $ref: "#/components/schemas/DeviceDetails" + responses: + 2XX: + content: + application/json: + schema: + $ref: "#/components/schemas/DeviceDetails" + application/x-msgpack: + schema: + $ref: "#/components/schemas/DeviceDetails" + text/html: + schema: + $ref: "#/components/schemas/DeviceDetails" + description: OK + default: + $ref: "#/components/responses/Error" + summary: Update a device registration + tags: + - Push + put: + description: Device registrations can be upserted (the existing registration is replaced entirely) with a PUT operation. Only clientId, metadata and push.recipient are mutable. + operationId: putPushDeviceDetails + parameters: + - $ref: "#/components/parameters/deviceId" + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/DeviceDetails" + application/x-msgpack: + schema: + $ref: "#/components/schemas/DeviceDetails" + application/x-www-form-urlencoded: + schema: + $ref: "#/components/schemas/DeviceDetails" + responses: + 2XX: + content: + application/json: + schema: + $ref: "#/components/schemas/DeviceDetails" + application/x-msgpack: + schema: + $ref: "#/components/schemas/DeviceDetails" + text/html: + schema: + $ref: "#/components/schemas/DeviceDetails" + description: OK + default: + $ref: "#/components/responses/Error" + summary: Update a device registration + tags: + - Push + "/push/deviceRegistrations/{device_id}/resetUpdateToken": + get: + description: Gets an updated device details object. + operationId: updatePushDeviceDetails + parameters: + - $ref: "#/components/parameters/deviceId" + responses: + 2XX: + content: + application/json: + schema: + $ref: "#/components/schemas/DeviceDetails" + application/x-msgpack: + schema: + $ref: "#/components/schemas/DeviceDetails" + text/html: + schema: + $ref: "#/components/schemas/DeviceDetails" + description: OK + default: + $ref: "#/components/responses/Error" + summary: Reset a registered device's update token + tags: + - Push + parameters: + - $ref: "#/components/parameters/versionHeader" + - $ref: "#/components/parameters/responseFormat" + /push/publish: + parameters: + - $ref: "#/components/parameters/versionHeader" + - $ref: "#/components/parameters/responseFormat" + post: + description: A convenience endpoint to deliver a push notification payload to a single device or set of devices identified by their client identifier. + operationId: publishPushNotificationToDevices + requestBody: + content: + application/json: + schema: + properties: + push: + $ref: "#/components/schemas/Push" + recipient: + $ref: "#/components/schemas/Recipient" + required: + - recipient + type: object + application/x-msgpack: + schema: + properties: + push: + $ref: "#/components/schemas/Push" + recipient: + $ref: "#/components/schemas/Recipient" + required: + - recipient + type: object + application/x-www-form-urlencoded: + schema: + properties: + push: + $ref: "#/components/schemas/Push" + recipient: + $ref: "#/components/schemas/Recipient" + required: + - recipient + type: object + responses: + 2XX: + description: OK + default: + $ref: "#/components/responses/Error" + summary: Publish a push notification to device(s) + tags: + - Push + /stats: + get: + description: The Ably system can be queried to obtain usage statistics for a given application, and results are provided aggregated across all channels in use in the application in the specified period. Stats may be used to track usage against account quotas. + operationId: getStats + parameters: + - $ref: "#/components/parameters/filterStart" + - $ref: "#/components/parameters/filterLimit" + - $ref: "#/components/parameters/filterEnd" + - $ref: "#/components/parameters/filterDirection" + - description: Specifies the unit of aggregation in the returned results. + in: query + name: unit + schema: + default: minute + enum: + - minute + - hour + - day + - month + type: string + responses: + 2XX: + content: + application/json: + schema: + type: object + description: OK + default: + $ref: "#/components/responses/Error" + summary: Retrieve usage statistics for an application + tags: + - Stats + parameters: + - $ref: "#/components/parameters/versionHeader" + - $ref: "#/components/parameters/responseFormat" + /time: + get: + description: This returns the service time in milliseconds since the epoch. + operationId: getTime + responses: + 2XX: + content: + application/json: + schema: + items: + type: integer + type: array + application/x-msgpack: + schema: + items: + type: integer + type: array + text/html: + schema: + type: string + description: OK + default: + $ref: "#/components/responses/Error" + summary: Get the service time + tags: + - Stats + parameters: + - $ref: "#/components/parameters/versionHeader" + - $ref: "#/components/parameters/responseFormat" +components: + headers: + ErrorCode: + description: The error code. + schema: + type: integer + ErrorMessage: + description: The error message. + schema: + type: string + Link: + description: Links to related resources, in the format defined by [RFC 5988](https://tools.ietf.org/html/rfc5988#section-5). This will potentially include a link with relation type `next`, `first`, and `current`, where appropiate. + required: true + schema: + pattern: (<(.*)?>; rel=\"(first|current|last)?\",)*(<(.*)?>; rel=\"(first|current|last)?\")+ + type: string + ServerId: + description: The ID for the server communicated with. + required: true + schema: + type: string + parameters: + channelId: + description: The [Channel's ID](https://www.ably.io/documentation/rest/channels). + in: path + name: channel_id + required: true + schema: + type: string + deviceId: + description: Device's ID. + in: path + name: device_id + required: true + schema: + type: string + filterDirection: + in: query + name: direction + schema: + default: backwards + enum: + - forwards + - backwards + type: string + filterEnd: + in: query + name: end + schema: + default: now + type: string + filterLimit: + in: query + name: limit + schema: + default: "100" + type: integer + filterStart: + in: query + name: start + schema: + type: string + key_name: + description: The [key name](https://www.ably.io/documentation/rest-api/token-request-spec#api-key-format) comprises of the app ID and key ID of an API key. + in: path + name: keyName + required: true + schema: + type: string + responseFormat: + description: The response format you would like + in: query + name: format + schema: + enum: + - json + - jsonp + - msgpack + - html + type: string + versionHeader: + description: The version of the API you wish to use. + in: header + name: X-Ably-Version + schema: + type: string + responses: + Error: + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + application/x-msgpack: + schema: + $ref: "#/components/schemas/Error" + text/html: + schema: + $ref: "#/components/schemas/Error" + description: Error + headers: + x-ably-errorcode: + $ref: "#/components/headers/ErrorCode" + x-ably-errormessage: + $ref: "#/components/headers/ErrorMessage" + x-ably-serverid: + $ref: "#/components/headers/ServerId" + schemas: + ChannelDetails: + properties: + channelId: + description: The required name of the channel including any qualifier, if any. + type: string + isGlobalMaster: + description: In events relating to the activity of a channel in a specific region, this optionally identifies whether or not that region is responsible for global coordination of the channel. + type: boolean + region: + description: In events relating to the activity of a channel in a specific region, this optionally identifies the region. + type: string + status: + $ref: "#/components/schemas/ChannelStatus" + required: + - channelId + type: object + ChannelStatus: + description: A ChannelStatus instance. + properties: + isActive: + description: A required boolean value indicating whether the channel that is the subject of the event is active. For events indicating regional activity of a channel this indicates activity in that region, not global activity. + type: boolean + occupancy: + $ref: "#/components/schemas/Occupancy" + required: + - isActive + type: object + DeviceDetails: + properties: + clientId: + description: Optional trusted client identifier for the device. + type: string + deviceSecret: + description: Secret value for the device. + type: string + formFactor: + description: Form factor of the push device. + enum: + - phone + - tablet + - desktop + - tv + - watch + - car + - embedded + type: string + id: + description: Unique identifier for the device generated by the device itself. + type: string + metadata: + description: Optional metadata object for this device. The metadata for a device may only be set by clients with push-admin privileges and will be used more extensively in the future with smart notifications. + type: object + platform: + description: Platform of the push device. + enum: + - ios + - android + type: string + push.recipient: + $ref: "#/components/schemas/Recipient" + push.state: + description: the current state of the push device. + enum: + - Active + - Failing + - Failed + readOnly: true + type: string + type: object + Error: + description: Returned error from failed REST. + properties: + code: + description: Error code. + type: integer + href: + description: Link to help with error. + type: string + message: + description: Message explaining the error's cause. + type: string + serverId: + description: Server ID with which error was encountered. + type: string + statusCode: + description: Status error code. + type: integer + type: object + Extras: + description: Extras object. Currently only allows for [push](https://www.ably.io/documentation/general/push/publish#channel-broadcast-example) extra. + properties: + push: + $ref: "#/components/schemas/Push" + type: object + Message: + description: Message object. + properties: + clientId: + description: The [client ID](https://www.ably.io/documentation/core-features/authentication#identified-clients) of the publisher of this message. + type: string + connectionId: + description: The connection ID of the publisher of this message. + type: string + data: + description: The string encoded payload, with the encoding specified below. + type: string + encoding: + description: This will typically be empty as all messages received from Ably are automatically decoded client-side using this value. However, if the message encoding cannot be processed, this attribute will contain the remaining transformations not applied to the data payload. + type: string + extras: + $ref: "#/components/schemas/Extras" + id: + description: A Unique ID that can be specified by the publisher for [idempotent publishing](https://www.ably.io/documentation/rest/messages#idempotent). + readOnly: true + type: string + name: + description: The event name, if provided. + type: string + timestamp: + description: Timestamp when the message was received by the Ably, as milliseconds since the epoch. + format: int64 + readOnly: true + type: integer + type: object + Notification: + properties: + body: + description: Text below title on the expanded notification. + type: string + collapseKey: + description: Platform-specific, used to group notifications together. + type: string + icon: + description: Platform-specific icon for the notification. + type: string + sound: + description: Platform-specific sound for the notification. + type: string + title: + description: Title to display at the notification. + type: string + type: object + Occupancy: + description: An Occupancy instance indicating the occupancy of a channel. For events indicating regional activity of a channel this indicates activity in that region, not global activity. + properties: + presenceConnections: + description: The number of connections that are authorised to enter members into the presence channel. + type: integer + presenceMembers: + description: The number of members currently entered into the presence channel. + type: integer + presenceSubscribers: + description: The number of connections that are authorised to subscribe to presence messages. + type: integer + publishers: + description: The number of connections attached to the channel that are authorised to publish. + type: integer + subscribers: + description: The number of connections attached that are authorised to subscribe to messages. + type: integer + type: object + PresenceMessage: + properties: + action: + description: The event signified by a PresenceMessage. + enum: + - ABSENT + - PRESENT + - ENTER + - LEAVE + - UPDATE + readOnly: true + type: string + clientId: + description: The client ID of the publisher of this presence update. + type: string + connectionId: + description: The connection ID of the publisher of this presence update. + type: string + data: + description: The presence update payload, if provided. + type: string + encoding: + description: This will typically be empty as all presence updates received from Ably are automatically decoded client-side using this value. However, if the message encoding cannot be processed, this attribute will contain the remaining transformations not applied to the data payload. + type: string + extras: + $ref: "#/components/schemas/Extras" + id: + description: Unique ID assigned by Ably to this presence update. + readOnly: true + type: string + timestamp: + description: Timestamp when the presence update was received by Ably, as milliseconds since the epoch. + format: int64 + readOnly: true + type: integer + type: object + Push: + properties: + apns: + description: Extends and overrides generic values when delivering via APNs. [See examples](https://www.ably.io/documentation/general/push/publish#payload-structure) + properties: + notification: + $ref: "#/components/schemas/Notification" + type: object + data: + description: Arbitrary [key-value string-to-string payload](https://www.ably.io/documentation/general/push/publish#channel-broadcast-example). + type: string + fcm: + description: Extends and overrides generic values when delivering via GCM/FCM. [See examples](https://www.ably.io/documentation/general/push/publish#payload-structure) + properties: + notification: + $ref: "#/components/schemas/Notification" + type: object + notification: + $ref: "#/components/schemas/Notification" + web: + description: Extends and overrides generic values when delivering via web. [See examples](https://www.ably.io/documentation/general/push/publish#payload-structure) + properties: + notification: + $ref: "#/components/schemas/Notification" + type: object + type: object + Recipient: + description: Push recipient details for a device. + properties: + clientId: + description: Client ID of recipient + type: string + writeOnly: true + deviceId: + description: Client ID of recipient + type: string + writeOnly: true + deviceToken: + description: when using APNs, specifies the required device token. + type: string + registrationToken: + description: when using GCM or FCM, specifies the required registration token. + type: string + transportType: + description: Defines which push platform is being used. + enum: + - apns + - fcm + - gcm + type: string + type: object + SignedTokenRequest: + allOf: + - $ref: "#/components/schemas/TokenRequest" + - properties: + mac: + description: A signature, generated as an HMAC of each of the above components, using the key secret value. + type: string + required: + - mac + type: object + TokenDetails: + properties: + capability: + description: Regular expression representation of the capabilities of the token. + type: string + expires: + description: Timestamp of token expiration. + type: integer + issued: + description: Timestamp of token creation. + type: integer + keyName: + description: Name of the key used to create the token + type: string + token: + description: The Ably Token. + type: string + type: object + TokenRequest: + properties: + capability: + description: The [capabilities](https://www.ably.io/documentation/core-features/authentication#capabilities-explained) (i.e. a set of channel names/namespaces and, for each, a set of operations) which should be a subset of the set of capabilities associated with the key specified in keyName. + example: + channel1: + - publish + - subscribe + type: object + clientId: + description: The [client ID](https://www.ably.io/documentation/core-features/authentication#identified-clients) to be assosciated with the token. Can be set to * to allow for any client ID to be used. + type: string + keyName: + description: Name of the key used for the TokenRequest. The keyName comprises of the app ID and key ID on an API Key. + example: xVLyHw.LMJZxw + type: string + nonce: + description: An unquoted, un-escaped random string of at least 16 characters. Used to ensure the Ably TokenRequest cannot be reused. + type: string + timestamp: + description: Time of creation of the Ably TokenRequest. + type: integer + required: + - keyName + - capability + - timestamp + - nonce + type: object + securitySchemes: + basicAuth: + description: Basic Authentication using an [API key](https://www.ably.io/documentation/core-features/authentication#basic-authentication). + scheme: basic + type: http + bearerAuth: + description: Token Authentication using an [Ably Token](https://www.ably.io/documentation/core-features/authentication#basic-authentication), or optionally an [Ably JWT](https://www.ably.io/documentation/core-features/authentication#ably-jwt-process). + scheme: bearer + type: http diff --git a/src/test/java/openapi/OpenAPIMain_test.java b/src/test/java/openapi/OpenAPIMain_test.java index a5c554df88aef61ad7d2a79efb3df57248e4fbbd..e1ba8d186c84769f419fe8c173308357d163ecba 100644 --- a/src/test/java/openapi/OpenAPIMain_test.java +++ b/src/test/java/openapi/OpenAPIMain_test.java @@ -12,25 +12,63 @@ import io.swagger.v3.core.util.Yaml; import io.swagger.v3.oas.models.OpenAPI; import io.swagger.v3.parser.OpenAPIV3Parser; import io.swagger.v3.parser.core.models.SwaggerParseResult; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.*; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; +import org.junit.jupiter.params.provider.ValueSource; import java.io.File; import java.io.IOException; import java.nio.file.Path; import java.nio.file.Paths; +import java.util.ArrayList; import java.util.List; +import java.util.stream.Stream; public class OpenAPIMain_test { - @Test - public void test() throws Exception { - File resource = new File("./src/main/resources"); + static List<File> resources = new ArrayList<>(); - recursiveTest(resource); + @BeforeAll + static void init() { + File r = new File("./src/main/resources"); + initResources(r); } - protected static void compareJson(JsonNode expectedNode, JsonNode actualNode, Path path) throws IOException { + @MethodSource("resources") + @ParameterizedTest + void parserTest(File file) throws Exception { + OpenAPIObject jastAddObject; + OpenAPI POJOOpenAPI; + ObjectMapper mapper = new ObjectMapper(); + List<String> validation; + + // parse OpenAPI in POJO, parse Json by POJO and validate OpenAPI-Json + SwaggerParseResult result = new OpenAPIParser().readLocation(file.getPath(), null, null); + POJOOpenAPI = result.getOpenAPI(); + System.out.println("Loading expression DSL file '" + file + "'."); + JsonNode expectedNode = mapper.readTree(Json.mapper().writeValueAsString(POJOOpenAPI)); + validation = new OpenAPIV3Parser().readContents(expectedNode.toString()).getMessages(); + + Assertions.assertFalse(validation.size() != 0, "validation of the input yaml not succeeded"); + + // parse OpenAPI in JastAdd, transform it to OpenAPI-POJO back and validate this + jastAddObject = OpenAPIObject.parseOpenAPI(POJOOpenAPI); + OpenAPI transformedAPI = OpenAPIObject.reverseOpenAPI(jastAddObject); + JsonNode actualNode = mapper.readTree(Json.mapper().writeValueAsString(transformedAPI)); + validation = new OpenAPIV3Parser().readContents(actualNode.toString()).getMessages(); + + Assertions.assertFalse(validation.size() != 0, "validation of the transformed yaml not succeeded"); + + // compare if parsed OpenAPI (source object, Json) is equivalent to back-transformed OpenAPI (generated object, Json) + compareJson(expectedNode, actualNode, Paths.get(file.getPath())); + } + + static Stream<File> resources() { + return resources.stream(); + } + + static void compareJson(JsonNode expectedNode, JsonNode actualNode, Path path) throws IOException { JsonNode diff = JsonDiff.asJson(expectedNode, actualNode); String pathNode; String result = ""; @@ -72,7 +110,7 @@ public class OpenAPIMain_test { } } - protected static boolean isNumeric(String str) { + static boolean isNumeric(String str) { try { int d = Integer.parseInt(str); } catch (NumberFormatException nfe) { @@ -81,51 +119,11 @@ public class OpenAPIMain_test { return true; } - protected static void recursiveTest(File file) throws Exception { + static void initResources(File file) { if ( file.isDirectory() ) { for ( File f : file.listFiles() ) - recursiveTest(f); - } else if ( file.isFile() && file.getPath().contains("yaml") ) { - OpenAPIObject jastAddObject; - OpenAPI POJOOpenAPI; - ObjectMapper mapper = new ObjectMapper(); - List<String> validation; - - // parsed openAPI object with swagger-parser - SwaggerParseResult result = new OpenAPIParser().readLocation(file.getPath(), null, null); - POJOOpenAPI = result.getOpenAPI(); - System.out.println("Loading expression DSL file '" + file + "'."); - - // validation of OpenAPI in POJO - JsonNode expectedNode = mapper.readTree(Json.mapper().writeValueAsString(POJOOpenAPI)); - validation = new OpenAPIV3Parser().readContents(expectedNode.toString()).getMessages(); - if ( validation.size() != 0 ) { - System.out.println("validation failed!"); - for ( String s : validation ) - System.out.println(s); - } - else - System.out.println("validated!"); - - // OpenAPI in POJO to OpenAPI in JastAdd - jastAddObject = OpenAPIObject.parseOpenAPI(POJOOpenAPI); - - // OpenAPI in JastAdd to OpenAPI in POJO - OpenAPI transformedAPI = OpenAPIObject.reverseOpenAPI(jastAddObject); - - // validation of transferred OpenAPI - JsonNode actualNode = mapper.readTree(Json.mapper().writeValueAsString(transformedAPI)); - validation = new OpenAPIV3Parser().readContents(actualNode.toString()).getMessages(); - if ( validation.size() != 0 ) { - System.out.println("validation failed!"); - for ( String s : validation ) - System.out.println(s); - } - else - System.out.println("validated"); - - // compare if api (source object) is equivalent to api3 (generated object) - compareJson(expectedNode, actualNode, Paths.get(file.getPath())); - } + initResources(f); + } else if ( file.isFile() && file.getPath().contains("yaml") ) + resources.add(file); } } \ No newline at end of file