diff --git a/.gradle/6.8/executionHistory/executionHistory.bin b/.gradle/6.8/executionHistory/executionHistory.bin index 578eed2b6fdac147d9bb45b5cb33fed0d7cd69c4..28161c506bbac8060af90b4fcba16b85aa53ca6b 100644 Binary files a/.gradle/6.8/executionHistory/executionHistory.bin and b/.gradle/6.8/executionHistory/executionHistory.bin differ diff --git a/.gradle/6.8/executionHistory/executionHistory.lock b/.gradle/6.8/executionHistory/executionHistory.lock index 9bee3b29920b079f9b289e6c793065ad3fb5cd0a..a2bc912533e2328ece478f35a818485edc0b0a4c 100644 Binary files a/.gradle/6.8/executionHistory/executionHistory.lock and b/.gradle/6.8/executionHistory/executionHistory.lock differ diff --git a/.gradle/6.8/fileHashes/fileHashes.bin b/.gradle/6.8/fileHashes/fileHashes.bin index 977f9a8f0862b9dd489c0a0b802fd99629602aed..9c5388a790971d71e5f2b99fa048737f453af634 100644 Binary files a/.gradle/6.8/fileHashes/fileHashes.bin and b/.gradle/6.8/fileHashes/fileHashes.bin differ diff --git a/.gradle/6.8/fileHashes/fileHashes.lock b/.gradle/6.8/fileHashes/fileHashes.lock index 12703db1a21433004859d86380296af021db54c8..b57969720434e7ce82c07409867525c8cd05733f 100644 Binary files a/.gradle/6.8/fileHashes/fileHashes.lock and b/.gradle/6.8/fileHashes/fileHashes.lock differ diff --git a/.gradle/6.8/fileHashes/resourceHashesCache.bin b/.gradle/6.8/fileHashes/resourceHashesCache.bin index 16c44a6fd91e32ce5545224b118c4c5e53fcecb9..fd3ea33b8171bd5a5c4f44071656a2f9aec627a9 100644 Binary files a/.gradle/6.8/fileHashes/resourceHashesCache.bin and b/.gradle/6.8/fileHashes/resourceHashesCache.bin differ diff --git a/.gradle/6.8/javaCompile/classAnalysis.bin b/.gradle/6.8/javaCompile/classAnalysis.bin index f41e7078d3b8d782741f69b48835bdbb720224da..961ff2cf4facbcc056d561330af1253f96669b5e 100644 Binary files a/.gradle/6.8/javaCompile/classAnalysis.bin and b/.gradle/6.8/javaCompile/classAnalysis.bin differ diff --git a/.gradle/6.8/javaCompile/jarAnalysis.bin b/.gradle/6.8/javaCompile/jarAnalysis.bin index b31271d7572229ccf5ba276ee78bf66e92513fdc..7d2315b661df6d6c38b82d3e04178f6350a23381 100644 Binary files a/.gradle/6.8/javaCompile/jarAnalysis.bin and b/.gradle/6.8/javaCompile/jarAnalysis.bin differ diff --git a/.gradle/6.8/javaCompile/javaCompile.lock b/.gradle/6.8/javaCompile/javaCompile.lock index 1bba057008af179ce830711b58ed7fb4948a2c0a..8b44fc3ceecb34ca671771eb52178222328016f0 100644 Binary files a/.gradle/6.8/javaCompile/javaCompile.lock and b/.gradle/6.8/javaCompile/javaCompile.lock differ diff --git a/.gradle/6.8/javaCompile/taskHistory.bin b/.gradle/6.8/javaCompile/taskHistory.bin index a6564b9ffc4f7bcceeb1b65326caf3d3960aed7a..99307cdee3f6555b42b38071fa8ffe44b56fab9a 100644 Binary files a/.gradle/6.8/javaCompile/taskHistory.bin and b/.gradle/6.8/javaCompile/taskHistory.bin differ diff --git a/.gradle/buildOutputCleanup/buildOutputCleanup.lock b/.gradle/buildOutputCleanup/buildOutputCleanup.lock index a76284bd4d4ee23b805a84c64b901e2d6a71edaf..35921eb3e9cb942ecd2192520720ec3d50fae849 100644 Binary files a/.gradle/buildOutputCleanup/buildOutputCleanup.lock and b/.gradle/buildOutputCleanup/buildOutputCleanup.lock differ diff --git a/.idea/jarRepositories.xml b/.idea/jarRepositories.xml index 1389d519b7937e2252c9298edefd669b61cccaef..0d2a28b0c58d26f0e26cac476c9944c8db1c9d5a 100644 --- a/.idea/jarRepositories.xml +++ b/.idea/jarRepositories.xml @@ -11,6 +11,11 @@ <option name="name" value="MavenRepo" /> <option name="url" value="https://repo.maven.apache.org/maven2/" /> </remote-repository> + <remote-repository> + <option name="id" value="MavenLocal" /> + <option name="name" value="MavenLocal" /> + <option name="url" value="file:/$MAVEN_REPOSITORY$/" /> + </remote-repository> <remote-repository> <option name="id" value="central" /> <option name="name" value="Maven Central repository" /> @@ -21,10 +26,5 @@ <option name="name" value="JBoss Community repository" /> <option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" /> </remote-repository> - <remote-repository> - <option name="id" value="MavenLocal" /> - <option name="name" value="MavenLocal" /> - <option name="url" value="file:/$MAVEN_REPOSITORY$/" /> - </remote-repository> </component> </project> \ No newline at end of file diff --git a/.idea/runConfigurations.xml b/.idea/runConfigurations.xml new file mode 100644 index 0000000000000000000000000000000000000000..797acea53eb091cf5b30518802c3073f544adeed --- /dev/null +++ b/.idea/runConfigurations.xml @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project version="4"> + <component name="RunConfigurationProducerService"> + <option name="ignoredProducers"> + <set> + <option value="com.android.tools.idea.compose.preview.runconfiguration.ComposePreviewRunConfigurationProducer" /> + </set> + </option> + </component> +</project> \ No newline at end of file diff --git a/build/classes/java/main/de/tudresden/inf/st/openapi/ast/ComponentsObject.class b/build/classes/java/main/de/tudresden/inf/st/openapi/ast/ComponentsObject.class index f0fd01158db0d9b78c0a7858551166bb9ca2db0f..e3bbe940cd9c2ac51301c412c9b717414b0df463 100644 Binary files a/build/classes/java/main/de/tudresden/inf/st/openapi/ast/ComponentsObject.class and b/build/classes/java/main/de/tudresden/inf/st/openapi/ast/ComponentsObject.class differ diff --git a/build/classes/java/main/de/tudresden/inf/st/openapi/ast/OpenAPIObject.class b/build/classes/java/main/de/tudresden/inf/st/openapi/ast/OpenAPIObject.class index a390b6e8f684e182024b8bdc6f740b86029f6b5e..60f683849850efe2080cb1ed809e0ec9cf2ab753 100644 Binary files a/build/classes/java/main/de/tudresden/inf/st/openapi/ast/OpenAPIObject.class and b/build/classes/java/main/de/tudresden/inf/st/openapi/ast/OpenAPIObject.class differ diff --git a/build/classes/java/main/de/tudresden/inf/st/openapi/ast/OperationObject.class b/build/classes/java/main/de/tudresden/inf/st/openapi/ast/OperationObject.class index bee6b00a7fbcb24224de0896065465999e5cc1c1..0bbd8da78e8e73243a3cec3809999e10864ca61a 100644 Binary files a/build/classes/java/main/de/tudresden/inf/st/openapi/ast/OperationObject.class and b/build/classes/java/main/de/tudresden/inf/st/openapi/ast/OperationObject.class differ diff --git a/build/classes/java/main/de/tudresden/inf/st/openapi/ast/SecurityRequirementObject.class b/build/classes/java/main/de/tudresden/inf/st/openapi/ast/SecurityRequirementObject.class index 0c652bfd67c91cff87fdde6a9e80eadc0d44e6d8..4cd345b3d65b9c0b247223eeb26a2fd2f0ed8242 100644 Binary files a/build/classes/java/main/de/tudresden/inf/st/openapi/ast/SecurityRequirementObject.class and b/build/classes/java/main/de/tudresden/inf/st/openapi/ast/SecurityRequirementObject.class differ diff --git a/build/classes/java/test/openapi/OpenAPIMain_test.class b/build/classes/java/test/openapi/OpenAPIMain_test.class index bf83408b1c106687ff6afc0f214d339be1daf312..b75eda80f274e24ffc35036c0c64c7f36a853f3b 100644 Binary files a/build/classes/java/test/openapi/OpenAPIMain_test.class and b/build/classes/java/test/openapi/OpenAPIMain_test.class differ diff --git a/build/reports/tests/test/classes/openapi.OpenAPIMain_test.html b/build/reports/tests/test/classes/openapi.OpenAPIMain_test.html index d1a377b1f4a9196d469561d548a494644b89c89a..d09c33d34adb5562c25404c80743100b777c939c 100644 --- a/build/reports/tests/test/classes/openapi.OpenAPIMain_test.html +++ b/build/reports/tests/test/classes/openapi.OpenAPIMain_test.html @@ -41,7 +41,7 @@ </td> <td> <div class="infoBox" id="duration"> -<div class="counter">0.371s</div> +<div class="counter">0.342s</div> <p>duration</p> </div> </td> @@ -76,73 +76,153 @@ <a name="test()"></a> <h3 class="failures">test()</h3> <span class="code"> -<pre>org.opentest4j.AssertionFailedError: JSONs for uspto.json are different: +<pre>org.opentest4j.AssertionFailedError: JSONs for link-example.json are different: [ { - "op" : "replace", - "path" : "/paths/~1{dataset}~1{version}~1records/post/responses/200/content/application~1json/schema/items/additionalProperties", + "op" : "add", + "path" : "/paths/~12.0~1repositories~1{username}/get/responses/200/content/application~1json/schema/items/$ref", + "value" : "#/components/schemas/repository" +}, { + "op" : "add", + "path" : "/paths/~12.0~1repositories~1{username}/get/responses/200/links", + "value" : { + "userRepository" : { + "$ref" : "#/components/links/UserRepository" + } + } +}, { + "op" : "add", + "path" : "/paths/~12.0~1users~1{username}/get/responses/200/content/application~1json/schema/$ref", + "value" : "#/components/schemas/user" +}, { + "op" : "add", + "path" : "/paths/~12.0~1users~1{username}/get/responses/200/links", + "value" : { + "userRepositories" : { + "$ref" : "#/components/links/UserRepositories" + } + } +}, { + "op" : "add", + "path" : "/paths/~12.0~1repositories~1{username}~1{slug}~1pullrequests~1{pid}/get/responses/200/content/application~1json/schema/$ref", + "value" : "#/components/schemas/pullrequest" +}, { + "op" : "add", + "path" : "/paths/~12.0~1repositories~1{username}~1{slug}~1pullrequests~1{pid}/get/responses/200/links", + "value" : { + "pullRequestMerge" : { + "$ref" : "#/components/links/PullRequestMerge" + } + } +}, { + "op" : "remove", + "path" : "/paths/~12.0~1repositories~1{username}~1{slug}~1pullrequests/get/parameters/2/required" +}, { + "op" : "add", + "path" : "/paths/~12.0~1repositories~1{username}~1{slug}~1pullrequests/get/parameters/2/schema/enum", + "value" : [ "open", "merged", "declined" ] +}, { + "op" : "add", + "path" : "/paths/~12.0~1repositories~1{username}~1{slug}~1pullrequests/get/responses/200/content/application~1json/schema/items/$ref", + "value" : "#/components/schemas/pullrequest" +}, { + "op" : "add", + "path" : "/paths/~12.0~1repositories~1{username}~1{slug}/get/responses/200/content/application~1json/schema/$ref", + "value" : "#/components/schemas/repository" +}, { + "op" : "add", + "path" : "/paths/~12.0~1repositories~1{username}~1{slug}/get/responses/200/links", "value" : { - "type" : "object" + "repositoryPullRequests" : { + "$ref" : "#/components/links/RepositoryPullRequests" + } } +}, { + "op" : "remove", + "path" : "/components/links/UserRepositories/operationRef" +}, { + "op" : "remove", + "path" : "/components/links/UserRepository/operationRef" +}, { + "op" : "remove", + "path" : "/components/links/PullRequestMerge/operationRef" +}, { + "op" : "remove", + "path" : "/components/links/RepositoryPullRequests/operationRef" +}, { + "op" : "add", + "path" : "/components/schemas/pullrequest/properties/author/$ref", + "value" : "#/components/schemas/user" +}, { + "op" : "add", + "path" : "/components/schemas/pullrequest/properties/repository/$ref", + "value" : "#/components/schemas/repository" }, { "op" : "add", - "path" : "/paths/~1/get/responses/200/content/application~1json/schema/$ref", - "value" : "#/components/schemas/dataSetList" + "path" : "/components/schemas/repository/properties/owner/$ref", + "value" : "#/components/schemas/user" } ] ==> expected: <{ - "openapi" : "3.0.1", + "openapi" : "3.0.0", "info" : { - "contact" : { - "email" : "developer@uspto.gov", - "name" : "Open Data Portal", - "url" : "https://developer.uspto.gov" - }, - "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.", - "title" : "USPTO Data Set API", + "title" : "Link Example", "version" : "1.0.0" }, - "servers" : [ { - "url" : "{scheme}://developer.uspto.gov/ds-api", - "variables" : { - "scheme" : { - "description" : "The Data Set API is accessible via https and http", - "default" : "https", - "enum" : [ "https", "http" ] - } - } - } ], - "tags" : [ { - "name" : "metadata", - "description" : "Find out about the data sets" - }, { - "name" : "search", - "description" : "Search a data set" - } ], "paths" : { - "/" : { + "/2.0/users/{username}" : { + "get" : { + "operationId" : "getUserByName", + "parameters" : [ { + "required" : true, + "schema" : { + "type" : "string" + }, + "in" : "path", + "name" : "username" + } ], + "responses" : { + "200" : { + "description" : "The User", + "links" : { + "userRepositories" : { + "$ref" : "#/components/links/UserRepositories" + } + }, + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/user" + } + } + } + } + } + } + }, + "/2.0/repositories/{username}" : { "get" : { - "tags" : [ "metadata" ], - "summary" : "List available data sets", - "operationId" : "list-data-sets", + "operationId" : "getRepositoriesByOwner", + "parameters" : [ { + "required" : true, + "schema" : { + "type" : "string" + }, + "in" : "path", + "name" : "username" + } ], "responses" : { "200" : { - "description" : "Returns a list of data sets", + "description" : "repositories owned by the supplied user", + "links" : { + "userRepository" : { + "$ref" : "#/components/links/UserRepository" + } + }, "content" : { "application/json" : { - "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" - } ] - }, "schema" : { - "$ref" : "#/components/schemas/dataSetList" + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/repository" + } } } } @@ -150,48 +230,78 @@ } } }, - "/{dataset}/{version}/fields" : { + "/2.0/repositories/{username}/{slug}" : { "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", + "operationId" : "getRepository", "parameters" : [ { - "description" : "Name of the dataset.", - "example" : "oa_citations", "required" : true, "schema" : { "type" : "string" }, "in" : "path", - "name" : "dataset" + "name" : "username" }, { - "description" : "Version of the dataset.", - "example" : "v1", "required" : true, "schema" : { "type" : "string" }, "in" : "path", - "name" : "version" + "name" : "slug" } ], "responses" : { "200" : { - "description" : "The dataset API for the given version is found and it is accessible to consume.", + "description" : "The repository", + "links" : { + "repositoryPullRequests" : { + "$ref" : "#/components/links/RepositoryPullRequests" + } + }, "content" : { "application/json" : { "schema" : { - "type" : "string" + "$ref" : "#/components/schemas/repository" } } } + } + } + } + }, + "/2.0/repositories/{username}/{slug}/pullrequests" : { + "get" : { + "operationId" : "getPullRequestsByRepository", + "parameters" : [ { + "required" : true, + "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.", + "in" : "path", + "name" : "username" + }, { + "required" : true, + "schema" : { + "type" : "string" + }, + "in" : "path", + "name" : "slug" + }, { + "schema" : { + "type" : "string", + "enum" : [ "open", "merged", "declined" ] + }, + "in" : "query", + "name" : "state" + } ], + "responses" : { + "200" : { + "description" : "an array of pull request objects", "content" : { "application/json" : { "schema" : { - "type" : "string" + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/pullrequest" + } } } } @@ -199,114 +309,150 @@ } } }, - "/{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", + "/2.0/repositories/{username}/{slug}/pullrequests/{pid}" : { + "get" : { + "operationId" : "getPullRequestsById", "parameters" : [ { - "description" : "Version of the dataset.", "required" : true, "schema" : { - "type" : "string", - "default" : "v1" + "type" : "string" }, "in" : "path", - "name" : "version" + "name" : "username" }, { - "description" : "Name of the dataset. In this case, the default value is oa_citations", "required" : true, "schema" : { - "type" : "string", - "default" : "oa_citations" + "type" : "string" }, "in" : "path", - "name" : "dataset" + "name" : "slug" + }, { + "required" : true, + "schema" : { + "type" : "string" + }, + "in" : "path", + "name" : "pid" } ], - "requestBody" : { - "content" : { - "application/x-www-form-urlencoded" : { - "schema" : { - "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 - } - }, - "type" : "object", - "required" : [ "criteria" ] - } - } - } - }, "responses" : { "200" : { - "description" : "successful operation", + "description" : "a pull request object", + "links" : { + "pullRequestMerge" : { + "$ref" : "#/components/links/PullRequestMerge" + } + }, "content" : { "application/json" : { "schema" : { - "type" : "array", - "items" : { - "type" : "object", - "additionalProperties" : { - "type" : "object" - } - } + "$ref" : "#/components/schemas/pullrequest" } } } + } + } + } + }, + "/2.0/repositories/{username}/{slug}/pullrequests/{pid}/merge" : { + "post" : { + "operationId" : "mergePullRequest", + "parameters" : [ { + "required" : true, + "schema" : { + "type" : "string" + }, + "in" : "path", + "name" : "username" + }, { + "required" : true, + "schema" : { + "type" : "string" + }, + "in" : "path", + "name" : "slug" + }, { + "required" : true, + "schema" : { + "type" : "string" }, - "404" : { - "description" : "No matching record found for the given criteria." + "in" : "path", + "name" : "pid" + } ], + "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" : { - "dataSetList" : { + "user" : { "properties" : { - "total" : { + "username" : { + "type" : "string" + }, + "uuid" : { + "type" : "string" + } + }, + "type" : "object" + }, + "repository" : { + "properties" : { + "slug" : { + "type" : "string" + }, + "owner" : { + "$ref" : "#/components/schemas/user" + } + }, + "type" : "object" + }, + "pullrequest" : { + "properties" : { + "id" : { "type" : "integer" }, - "apis" : { - "type" : "array", - "items" : { - "properties" : { - "apiKey" : { - "description" : "To be used as a dataset parameter value", - "type" : "string" - }, - "apiVersionNumber" : { - "description" : "To be used as a version parameter value", - "type" : "string" - }, - "apiUrl" : { - "description" : "The URL describing the dataset's fields", - "format" : "uriref", - "type" : "string" - }, - "apiDocumentationUrl" : { - "description" : "A URL to the API console for each API", - "format" : "uriref", - "type" : "string" - } - }, - "type" : "object" - } + "title" : { + "type" : "string" + }, + "repository" : { + "$ref" : "#/components/schemas/repository" + }, + "author" : { + "$ref" : "#/components/schemas/user" } }, "type" : "object" @@ -314,150 +460,163 @@ } } }> but was: <{ - "openapi" : "3.0.1", + "openapi" : "3.0.0", "info" : { - "contact" : { - "email" : "developer@uspto.gov", - "name" : "Open Data Portal", - "url" : "https://developer.uspto.gov" - }, - "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.", - "title" : "USPTO Data Set API", + "title" : "Link Example", "version" : "1.0.0" }, - "servers" : [ { - "url" : "{scheme}://developer.uspto.gov/ds-api", - "variables" : { - "scheme" : { - "description" : "The Data Set API is accessible via https and http", - "default" : "https", - "enum" : [ "https", "http" ] - } - } - } ], - "tags" : [ { - "name" : "metadata", - "description" : "Find out about the data sets" - }, { - "name" : "search", - "description" : "Search a data set" - } ], "paths" : { - "/{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", + "/2.0/repositories/{username}" : { + "get" : { + "operationId" : "getRepositoriesByOwner", "parameters" : [ { - "description" : "Version of the dataset.", - "required" : true, - "schema" : { - "type" : "string", - "default" : "v1" - }, - "in" : "path", - "name" : "version" - }, { - "description" : "Name of the dataset. In this case, the default value is oa_citations", "required" : true, "schema" : { - "type" : "string", - "default" : "oa_citations" + "type" : "string" }, "in" : "path", - "name" : "dataset" + "name" : "username" } ], - "requestBody" : { - "content" : { - "application/x-www-form-urlencoded" : { - "schema" : { - "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 - } - }, - "type" : "object", - "required" : [ "criteria" ] - } - } - } - }, "responses" : { "200" : { - "description" : "successful operation", + "description" : "repositories owned by the supplied user", "content" : { "application/json" : { "schema" : { "type" : "array", - "items" : { - "type" : "object", - "additionalProperties" : false - } + "items" : { } } } } + } + } + } + }, + "/2.0/users/{username}" : { + "get" : { + "operationId" : "getUserByName", + "parameters" : [ { + "required" : true, + "schema" : { + "type" : "string" }, - "404" : { - "description" : "No matching record found for the given criteria." + "in" : "path", + "name" : "username" + } ], + "responses" : { + "200" : { + "description" : "The User", + "content" : { + "application/json" : { + "schema" : { } + } + } } } } }, - "/{dataset}/{version}/fields" : { + "/2.0/repositories/{username}/{slug}/pullrequests/{pid}" : { "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", + "operationId" : "getPullRequestsById", "parameters" : [ { - "description" : "Name of the dataset.", - "example" : "oa_citations", "required" : true, "schema" : { "type" : "string" }, "in" : "path", - "name" : "dataset" + "name" : "username" + }, { + "required" : true, + "schema" : { + "type" : "string" + }, + "in" : "path", + "name" : "slug" }, { - "description" : "Version of the dataset.", - "example" : "v1", "required" : true, "schema" : { "type" : "string" }, "in" : "path", - "name" : "version" + "name" : "pid" } ], "responses" : { "200" : { - "description" : "The dataset API for the given version is found and it is accessible to consume.", + "description" : "a pull request object", "content" : { "application/json" : { - "schema" : { - "type" : "string" - } + "schema" : { } } } + } + } + } + }, + "/2.0/repositories/{username}/{slug}/pullrequests/{pid}/merge" : { + "post" : { + "operationId" : "mergePullRequest", + "parameters" : [ { + "required" : true, + "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.", + "in" : "path", + "name" : "username" + }, { + "required" : true, + "schema" : { + "type" : "string" + }, + "in" : "path", + "name" : "slug" + }, { + "required" : true, + "schema" : { + "type" : "string" + }, + "in" : "path", + "name" : "pid" + } ], + "responses" : { + "204" : { + "description" : "the PR was successfully merged" + } + } + } + }, + "/2.0/repositories/{username}/{slug}/pullrequests" : { + "get" : { + "operationId" : "getPullRequestsByRepository", + "parameters" : [ { + "required" : true, + "schema" : { + "type" : "string" + }, + "in" : "path", + "name" : "username" + }, { + "required" : true, + "schema" : { + "type" : "string" + }, + "in" : "path", + "name" : "slug" + }, { + "required" : false, + "schema" : { + "type" : "string" + }, + "in" : "query", + "name" : "state" + } ], + "responses" : { + "200" : { + "description" : "an array of pull request objects", "content" : { "application/json" : { "schema" : { - "type" : "string" + "type" : "array", + "items" : { } } } } @@ -465,30 +624,29 @@ } } }, - "/" : { + "/2.0/repositories/{username}/{slug}" : { "get" : { - "tags" : [ "metadata" ], - "summary" : "List available data sets", - "operationId" : "list-data-sets", + "operationId" : "getRepository", + "parameters" : [ { + "required" : true, + "schema" : { + "type" : "string" + }, + "in" : "path", + "name" : "username" + }, { + "required" : true, + "schema" : { + "type" : "string" + }, + "in" : "path", + "name" : "slug" + } ], "responses" : { "200" : { - "description" : "Returns a list of data sets", + "description" : "The repository", "content" : { "application/json" : { - "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" - } ] - }, "schema" : { } } } @@ -498,37 +656,70 @@ } }, "components" : { + "links" : { + "UserRepositories" : { + "operationId" : "getRepositoriesByOwner", + "operationRef" : "", + "parameters" : { + "username" : "$response.body#/username" + } + }, + "UserRepository" : { + "operationId" : "getRepository", + "operationRef" : "", + "parameters" : { + "slug" : "$response.body#/slug", + "username" : "$response.body#/owner/username" + } + }, + "PullRequestMerge" : { + "operationId" : "mergePullRequest", + "operationRef" : "", + "parameters" : { + "pid" : "$response.body#/id", + "slug" : "$response.body#/repository/slug", + "username" : "$response.body#/author/username" + } + }, + "RepositoryPullRequests" : { + "operationId" : "getPullRequestsByRepository", + "operationRef" : "", + "parameters" : { + "slug" : "$response.body#/slug", + "username" : "$response.body#/owner/username" + } + } + }, "schemas" : { - "dataSetList" : { + "pullrequest" : { "properties" : { - "total" : { + "author" : { }, + "id" : { "type" : "integer" }, - "apis" : { - "type" : "array", - "items" : { - "properties" : { - "apiKey" : { - "description" : "To be used as a dataset parameter value", - "type" : "string" - }, - "apiUrl" : { - "description" : "The URL describing the dataset's fields", - "format" : "uriref", - "type" : "string" - }, - "apiDocumentationUrl" : { - "description" : "A URL to the API console for each API", - "format" : "uriref", - "type" : "string" - }, - "apiVersionNumber" : { - "description" : "To be used as a version parameter value", - "type" : "string" - } - }, - "type" : "object" - } + "title" : { + "type" : "string" + }, + "repository" : { } + }, + "type" : "object" + }, + "repository" : { + "properties" : { + "owner" : { }, + "slug" : { + "type" : "string" + } + }, + "type" : "object" + }, + "user" : { + "properties" : { + "uuid" : { + "type" : "string" + }, + "username" : { + "type" : "string" } }, "type" : "object" @@ -540,8 +731,8 @@ at org.junit.jupiter.api.AssertionUtils.failNotEqual(AssertionUtils.java:62) at org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:182) at org.junit.jupiter.api.Assertions.assertEquals(Assertions.java:1135) - at openapi.OpenAPIMain_test.compareJson(OpenAPIMain_test.java:80) - at openapi.OpenAPIMain_test.test(OpenAPIMain_test.java:67) + at openapi.OpenAPIMain_test.compareJson(OpenAPIMain_test.java:89) + at openapi.OpenAPIMain_test.test(OpenAPIMain_test.java:75) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) @@ -573,7 +764,7 @@ at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73) at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:126) at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:84) - at java.base/java.util.ArrayList.forEach(ArrayList.java:1540) + at java.base/java.util.ArrayList.forEach(ArrayList.java:1541) at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:38) at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:143) at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73) @@ -583,7 +774,7 @@ at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73) at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:126) at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:84) - at java.base/java.util.ArrayList.forEach(ArrayList.java:1540) + at java.base/java.util.ArrayList.forEach(ArrayList.java:1541) at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:38) at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:143) at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73) @@ -631,7 +822,7 @@ at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:56) - at java.base/java.lang.Thread.run(Thread.java:834) + at java.base/java.lang.Thread.run(Thread.java:829) </pre> </span> </div> @@ -648,7 +839,7 @@ </thead> <tr> <td class="failures">test()</td> -<td class="failures">0.371s</td> +<td class="failures">0.342s</td> <td class="failures">failed</td> </tr> </table> @@ -656,7 +847,13 @@ <div id="tab2" class="tab"> <h2>Standard output</h2> <span class="code"> -<pre>Loading expression DSL file 'uspto.json'. +<pre>Loading expression DSL file 'api-with-examples.json'. +Is the source object valid? : true +Is the generated object valid? : true +Loading expression DSL file 'callback-example.json'. +Is the source object valid? : true +Is the generated object valid? : true +Loading expression DSL file 'link-example.json'. Is the source object valid? : true Is the generated object valid? : true </pre> @@ -670,7 +867,7 @@ Is the generated object valid? : true <input id="line-wrapping-toggle" type="checkbox" autocomplete="off"/> </label> </div>Generated by -<a href="http://www.gradle.org">Gradle 6.8</a> at 2021. 8. 10. 오후 2:11:46</p> +<a href="http://www.gradle.org">Gradle 6.8</a> at 2021. 8. 13. 오전 2:47:54</p> </div> </div> </body> diff --git a/build/reports/tests/test/index.html b/build/reports/tests/test/index.html index 03f9286f20cdc59223504d2a9210235fb6b5a3e5..58d49c46436224db576319cf266455ebd7819e1b 100644 --- a/build/reports/tests/test/index.html +++ b/build/reports/tests/test/index.html @@ -38,7 +38,7 @@ </td> <td> <div class="infoBox" id="duration"> -<div class="counter">0.371s</div> +<div class="counter">0.342s</div> <p>duration</p> </div> </td> @@ -97,7 +97,7 @@ <td>1</td> <td>1</td> <td>0</td> -<td>0.371s</td> +<td>0.342s</td> <td class="failures">0%</td> </tr> </tbody> @@ -124,7 +124,7 @@ <td>1</td> <td>1</td> <td>0</td> -<td>0.371s</td> +<td>0.342s</td> <td class="failures">0%</td> </tr> </tbody> @@ -138,7 +138,7 @@ <input id="line-wrapping-toggle" type="checkbox" autocomplete="off"/> </label> </div>Generated by -<a href="http://www.gradle.org">Gradle 6.8</a> at 2021. 8. 10. 오후 2:11:46</p> +<a href="http://www.gradle.org">Gradle 6.8</a> at 2021. 8. 13. 오전 2:47:54</p> </div> </div> </body> diff --git a/build/reports/tests/test/packages/openapi.html b/build/reports/tests/test/packages/openapi.html index fa35580832bbc8a40f4df5570c0b262d552a1fc4..df5098e8192e94f4ce5131f76c4a10e79791ce7d 100644 --- a/build/reports/tests/test/packages/openapi.html +++ b/build/reports/tests/test/packages/openapi.html @@ -40,7 +40,7 @@ </td> <td> <div class="infoBox" id="duration"> -<div class="counter">0.371s</div> +<div class="counter">0.342s</div> <p>duration</p> </div> </td> @@ -95,7 +95,7 @@ <td>1</td> <td>1</td> <td>0</td> -<td>0.371s</td> +<td>0.342s</td> <td class="failures">0%</td> </tr> </table> @@ -108,7 +108,7 @@ <input id="line-wrapping-toggle" type="checkbox" autocomplete="off"/> </label> </div>Generated by -<a href="http://www.gradle.org">Gradle 6.8</a> at 2021. 8. 10. 오후 2:11:46</p> +<a href="http://www.gradle.org">Gradle 6.8</a> at 2021. 8. 13. 오전 2:47:54</p> </div> </div> </body> diff --git a/build/test-results/test/TEST-openapi.OpenAPIMain_test.xml b/build/test-results/test/TEST-openapi.OpenAPIMain_test.xml index 5ae4ef9a16400b855db560f3f129f4bc585d0c43..8febe0adae965cec130fce482ac5d7bdfd67e3bf 100644 --- a/build/test-results/test/TEST-openapi.OpenAPIMain_test.xml +++ b/build/test-results/test/TEST-openapi.OpenAPIMain_test.xml @@ -1,74 +1,154 @@ <?xml version="1.0" encoding="UTF-8"?> -<testsuite name="openapi.OpenAPIMain_test" tests="1" skipped="0" failures="1" errors="0" timestamp="2021-08-10T05:11:45" hostname="DESKTOP-5DL2OO8" time="0.371"> +<testsuite name="openapi.OpenAPIMain_test" tests="1" skipped="0" failures="1" errors="0" timestamp="2021-08-12T17:47:54" hostname="DESKTOP-RAH69DT" time="0.342"> <properties/> - <testcase name="test()" classname="openapi.OpenAPIMain_test" time="0.371"> - <failure message="org.opentest4j.AssertionFailedError: JSONs for uspto.json are different: [ { "op" : "replace", "path" : "/paths/~1{dataset}~1{version}~1records/post/responses/200/content/application~1json/schema/items/additionalProperties", "value" : { "type" : "object" } }, { "op" : "add", "path" : "/paths/~1/get/responses/200/content/application~1json/schema/$ref", "value" : "#/components/schemas/dataSetList" } ] ==> expected: <{ "openapi" : "3.0.1", "info" : { "contact" : { "email" : "developer@uspto.gov", "name" : "Open Data Portal", "url" : "https://developer.uspto.gov" }, "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.", "title" : "USPTO Data Set API", "version" : "1.0.0" }, "servers" : [ { "url" : "{scheme}://developer.uspto.gov/ds-api", "variables" : { "scheme" : { "description" : "The Data Set API is accessible via https and http", "default" : "https", "enum" : [ "https", "http" ] } } } ], "tags" : [ { "name" : "metadata", "description" : "Find out about the data sets" }, { "name" : "search", "description" : "Search a data set" } ], "paths" : { "/" : { "get" : { "tags" : [ "metadata" ], "summary" : "List available data sets", "operationId" : "list-data-sets", "responses" : { "200" : { "description" : "Returns a list of data sets", "content" : { "application/json" : { "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" } ] }, "schema" : { "$ref" : "#/components/schemas/dataSetList" } } } } } } }, "/{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" : [ { "description" : "Name of the dataset.", "example" : "oa_citations", "required" : true, "schema" : { "type" : "string" }, "in" : "path", "name" : "dataset" }, { "description" : "Version of the dataset.", "example" : "v1", "required" : true, "schema" : { "type" : "string" }, "in" : "path", "name" : "version" } ], "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" : [ { "description" : "Version of the dataset.", "required" : true, "schema" : { "type" : "string", "default" : "v1" }, "in" : "path", "name" : "version" }, { "description" : "Name of the dataset. In this case, the default value is oa_citations", "required" : true, "schema" : { "type" : "string", "default" : "oa_citations" }, "in" : "path", "name" : "dataset" } ], "requestBody" : { "content" : { "application/x-www-form-urlencoded" : { "schema" : { "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 } }, "type" : "object", "required" : [ "criteria" ] } } } }, "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." } } } } }, "components" : { "schemas" : { "dataSetList" : { "properties" : { "total" : { "type" : "integer" }, "apis" : { "type" : "array", "items" : { "properties" : { "apiKey" : { "description" : "To be used as a dataset parameter value", "type" : "string" }, "apiVersionNumber" : { "description" : "To be used as a version parameter value", "type" : "string" }, "apiUrl" : { "description" : "The URL describing the dataset's fields", "format" : "uriref", "type" : "string" }, "apiDocumentationUrl" : { "description" : "A URL to the API console for each API", "format" : "uriref", "type" : "string" } }, "type" : "object" } } }, "type" : "object" } } } }> but was: <{ "openapi" : "3.0.1", "info" : { "contact" : { "email" : "developer@uspto.gov", "name" : "Open Data Portal", "url" : "https://developer.uspto.gov" }, "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.", "title" : "USPTO Data Set API", "version" : "1.0.0" }, "servers" : [ { "url" : "{scheme}://developer.uspto.gov/ds-api", "variables" : { "scheme" : { "description" : "The Data Set API is accessible via https and http", "default" : "https", "enum" : [ "https", "http" ] } } } ], "tags" : [ { "name" : "metadata", "description" : "Find out about the data sets" }, { "name" : "search", "description" : "Search a data set" } ], "paths" : { "/{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" : [ { "description" : "Version of the dataset.", "required" : true, "schema" : { "type" : "string", "default" : "v1" }, "in" : "path", "name" : "version" }, { "description" : "Name of the dataset. In this case, the default value is oa_citations", "required" : true, "schema" : { "type" : "string", "default" : "oa_citations" }, "in" : "path", "name" : "dataset" } ], "requestBody" : { "content" : { "application/x-www-form-urlencoded" : { "schema" : { "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 } }, "type" : "object", "required" : [ "criteria" ] } } } }, "responses" : { "200" : { "description" : "successful operation", "content" : { "application/json" : { "schema" : { "type" : "array", "items" : { "type" : "object", "additionalProperties" : false } } } } }, "404" : { "description" : "No matching record found for the given criteria." } } } }, "/{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" : [ { "description" : "Name of the dataset.", "example" : "oa_citations", "required" : true, "schema" : { "type" : "string" }, "in" : "path", "name" : "dataset" }, { "description" : "Version of the dataset.", "example" : "v1", "required" : true, "schema" : { "type" : "string" }, "in" : "path", "name" : "version" } ], "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" } } } } } } }, "/" : { "get" : { "tags" : [ "metadata" ], "summary" : "List available data sets", "operationId" : "list-data-sets", "responses" : { "200" : { "description" : "Returns a list of data sets", "content" : { "application/json" : { "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" } ] }, "schema" : { } } } } } } } }, "components" : { "schemas" : { "dataSetList" : { "properties" : { "total" : { "type" : "integer" }, "apis" : { "type" : "array", "items" : { "properties" : { "apiKey" : { "description" : "To be used as a dataset parameter value", "type" : "string" }, "apiUrl" : { "description" : "The URL describing the dataset's fields", "format" : "uriref", "type" : "string" }, "apiDocumentationUrl" : { "description" : "A URL to the API console for each API", "format" : "uriref", "type" : "string" }, "apiVersionNumber" : { "description" : "To be used as a version parameter value", "type" : "string" } }, "type" : "object" } } }, "type" : "object" } } } }>" type="org.opentest4j.AssertionFailedError">org.opentest4j.AssertionFailedError: JSONs for uspto.json are different: + <testcase name="test()" classname="openapi.OpenAPIMain_test" time="0.342"> + <failure message="org.opentest4j.AssertionFailedError: JSONs for link-example.json are different: [ { "op" : "add", "path" : "/paths/~12.0~1repositories~1{username}/get/responses/200/content/application~1json/schema/items/$ref", "value" : "#/components/schemas/repository" }, { "op" : "add", "path" : "/paths/~12.0~1repositories~1{username}/get/responses/200/links", "value" : { "userRepository" : { "$ref" : "#/components/links/UserRepository" } } }, { "op" : "add", "path" : "/paths/~12.0~1users~1{username}/get/responses/200/content/application~1json/schema/$ref", "value" : "#/components/schemas/user" }, { "op" : "add", "path" : "/paths/~12.0~1users~1{username}/get/responses/200/links", "value" : { "userRepositories" : { "$ref" : "#/components/links/UserRepositories" } } }, { "op" : "add", "path" : "/paths/~12.0~1repositories~1{username}~1{slug}~1pullrequests~1{pid}/get/responses/200/content/application~1json/schema/$ref", "value" : "#/components/schemas/pullrequest" }, { "op" : "add", "path" : "/paths/~12.0~1repositories~1{username}~1{slug}~1pullrequests~1{pid}/get/responses/200/links", "value" : { "pullRequestMerge" : { "$ref" : "#/components/links/PullRequestMerge" } } }, { "op" : "remove", "path" : "/paths/~12.0~1repositories~1{username}~1{slug}~1pullrequests/get/parameters/2/required" }, { "op" : "add", "path" : "/paths/~12.0~1repositories~1{username}~1{slug}~1pullrequests/get/parameters/2/schema/enum", "value" : [ "open", "merged", "declined" ] }, { "op" : "add", "path" : "/paths/~12.0~1repositories~1{username}~1{slug}~1pullrequests/get/responses/200/content/application~1json/schema/items/$ref", "value" : "#/components/schemas/pullrequest" }, { "op" : "add", "path" : "/paths/~12.0~1repositories~1{username}~1{slug}/get/responses/200/content/application~1json/schema/$ref", "value" : "#/components/schemas/repository" }, { "op" : "add", "path" : "/paths/~12.0~1repositories~1{username}~1{slug}/get/responses/200/links", "value" : { "repositoryPullRequests" : { "$ref" : "#/components/links/RepositoryPullRequests" } } }, { "op" : "remove", "path" : "/components/links/UserRepositories/operationRef" }, { "op" : "remove", "path" : "/components/links/UserRepository/operationRef" }, { "op" : "remove", "path" : "/components/links/PullRequestMerge/operationRef" }, { "op" : "remove", "path" : "/components/links/RepositoryPullRequests/operationRef" }, { "op" : "add", "path" : "/components/schemas/pullrequest/properties/author/$ref", "value" : "#/components/schemas/user" }, { "op" : "add", "path" : "/components/schemas/pullrequest/properties/repository/$ref", "value" : "#/components/schemas/repository" }, { "op" : "add", "path" : "/components/schemas/repository/properties/owner/$ref", "value" : "#/components/schemas/user" } ] ==> expected: <{ "openapi" : "3.0.0", "info" : { "title" : "Link Example", "version" : "1.0.0" }, "paths" : { "/2.0/users/{username}" : { "get" : { "operationId" : "getUserByName", "parameters" : [ { "required" : true, "schema" : { "type" : "string" }, "in" : "path", "name" : "username" } ], "responses" : { "200" : { "description" : "The User", "links" : { "userRepositories" : { "$ref" : "#/components/links/UserRepositories" } }, "content" : { "application/json" : { "schema" : { "$ref" : "#/components/schemas/user" } } } } } } }, "/2.0/repositories/{username}" : { "get" : { "operationId" : "getRepositoriesByOwner", "parameters" : [ { "required" : true, "schema" : { "type" : "string" }, "in" : "path", "name" : "username" } ], "responses" : { "200" : { "description" : "repositories owned by the supplied user", "links" : { "userRepository" : { "$ref" : "#/components/links/UserRepository" } }, "content" : { "application/json" : { "schema" : { "type" : "array", "items" : { "$ref" : "#/components/schemas/repository" } } } } } } } }, "/2.0/repositories/{username}/{slug}" : { "get" : { "operationId" : "getRepository", "parameters" : [ { "required" : true, "schema" : { "type" : "string" }, "in" : "path", "name" : "username" }, { "required" : true, "schema" : { "type" : "string" }, "in" : "path", "name" : "slug" } ], "responses" : { "200" : { "description" : "The repository", "links" : { "repositoryPullRequests" : { "$ref" : "#/components/links/RepositoryPullRequests" } }, "content" : { "application/json" : { "schema" : { "$ref" : "#/components/schemas/repository" } } } } } } }, "/2.0/repositories/{username}/{slug}/pullrequests" : { "get" : { "operationId" : "getPullRequestsByRepository", "parameters" : [ { "required" : true, "schema" : { "type" : "string" }, "in" : "path", "name" : "username" }, { "required" : true, "schema" : { "type" : "string" }, "in" : "path", "name" : "slug" }, { "schema" : { "type" : "string", "enum" : [ "open", "merged", "declined" ] }, "in" : "query", "name" : "state" } ], "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" : [ { "required" : true, "schema" : { "type" : "string" }, "in" : "path", "name" : "username" }, { "required" : true, "schema" : { "type" : "string" }, "in" : "path", "name" : "slug" }, { "required" : true, "schema" : { "type" : "string" }, "in" : "path", "name" : "pid" } ], "responses" : { "200" : { "description" : "a pull request object", "links" : { "pullRequestMerge" : { "$ref" : "#/components/links/PullRequestMerge" } }, "content" : { "application/json" : { "schema" : { "$ref" : "#/components/schemas/pullrequest" } } } } } } }, "/2.0/repositories/{username}/{slug}/pullrequests/{pid}/merge" : { "post" : { "operationId" : "mergePullRequest", "parameters" : [ { "required" : true, "schema" : { "type" : "string" }, "in" : "path", "name" : "username" }, { "required" : true, "schema" : { "type" : "string" }, "in" : "path", "name" : "slug" }, { "required" : true, "schema" : { "type" : "string" }, "in" : "path", "name" : "pid" } ], "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" : { "properties" : { "username" : { "type" : "string" }, "uuid" : { "type" : "string" } }, "type" : "object" }, "repository" : { "properties" : { "slug" : { "type" : "string" }, "owner" : { "$ref" : "#/components/schemas/user" } }, "type" : "object" }, "pullrequest" : { "properties" : { "id" : { "type" : "integer" }, "title" : { "type" : "string" }, "repository" : { "$ref" : "#/components/schemas/repository" }, "author" : { "$ref" : "#/components/schemas/user" } }, "type" : "object" } } } }> but was: <{ "openapi" : "3.0.0", "info" : { "title" : "Link Example", "version" : "1.0.0" }, "paths" : { "/2.0/repositories/{username}" : { "get" : { "operationId" : "getRepositoriesByOwner", "parameters" : [ { "required" : true, "schema" : { "type" : "string" }, "in" : "path", "name" : "username" } ], "responses" : { "200" : { "description" : "repositories owned by the supplied user", "content" : { "application/json" : { "schema" : { "type" : "array", "items" : { } } } } } } } }, "/2.0/users/{username}" : { "get" : { "operationId" : "getUserByName", "parameters" : [ { "required" : true, "schema" : { "type" : "string" }, "in" : "path", "name" : "username" } ], "responses" : { "200" : { "description" : "The User", "content" : { "application/json" : { "schema" : { } } } } } } }, "/2.0/repositories/{username}/{slug}/pullrequests/{pid}" : { "get" : { "operationId" : "getPullRequestsById", "parameters" : [ { "required" : true, "schema" : { "type" : "string" }, "in" : "path", "name" : "username" }, { "required" : true, "schema" : { "type" : "string" }, "in" : "path", "name" : "slug" }, { "required" : true, "schema" : { "type" : "string" }, "in" : "path", "name" : "pid" } ], "responses" : { "200" : { "description" : "a pull request object", "content" : { "application/json" : { "schema" : { } } } } } } }, "/2.0/repositories/{username}/{slug}/pullrequests/{pid}/merge" : { "post" : { "operationId" : "mergePullRequest", "parameters" : [ { "required" : true, "schema" : { "type" : "string" }, "in" : "path", "name" : "username" }, { "required" : true, "schema" : { "type" : "string" }, "in" : "path", "name" : "slug" }, { "required" : true, "schema" : { "type" : "string" }, "in" : "path", "name" : "pid" } ], "responses" : { "204" : { "description" : "the PR was successfully merged" } } } }, "/2.0/repositories/{username}/{slug}/pullrequests" : { "get" : { "operationId" : "getPullRequestsByRepository", "parameters" : [ { "required" : true, "schema" : { "type" : "string" }, "in" : "path", "name" : "username" }, { "required" : true, "schema" : { "type" : "string" }, "in" : "path", "name" : "slug" }, { "required" : false, "schema" : { "type" : "string" }, "in" : "query", "name" : "state" } ], "responses" : { "200" : { "description" : "an array of pull request objects", "content" : { "application/json" : { "schema" : { "type" : "array", "items" : { } } } } } } } }, "/2.0/repositories/{username}/{slug}" : { "get" : { "operationId" : "getRepository", "parameters" : [ { "required" : true, "schema" : { "type" : "string" }, "in" : "path", "name" : "username" }, { "required" : true, "schema" : { "type" : "string" }, "in" : "path", "name" : "slug" } ], "responses" : { "200" : { "description" : "The repository", "content" : { "application/json" : { "schema" : { } } } } } } } }, "components" : { "links" : { "UserRepositories" : { "operationId" : "getRepositoriesByOwner", "operationRef" : "", "parameters" : { "username" : "$response.body#/username" } }, "UserRepository" : { "operationId" : "getRepository", "operationRef" : "", "parameters" : { "slug" : "$response.body#/slug", "username" : "$response.body#/owner/username" } }, "PullRequestMerge" : { "operationId" : "mergePullRequest", "operationRef" : "", "parameters" : { "pid" : "$response.body#/id", "slug" : "$response.body#/repository/slug", "username" : "$response.body#/author/username" } }, "RepositoryPullRequests" : { "operationId" : "getPullRequestsByRepository", "operationRef" : "", "parameters" : { "slug" : "$response.body#/slug", "username" : "$response.body#/owner/username" } } }, "schemas" : { "pullrequest" : { "properties" : { "author" : { }, "id" : { "type" : "integer" }, "title" : { "type" : "string" }, "repository" : { } }, "type" : "object" }, "repository" : { "properties" : { "owner" : { }, "slug" : { "type" : "string" } }, "type" : "object" }, "user" : { "properties" : { "uuid" : { "type" : "string" }, "username" : { "type" : "string" } }, "type" : "object" } } } }>" type="org.opentest4j.AssertionFailedError">org.opentest4j.AssertionFailedError: JSONs for link-example.json are different: [ { - "op" : "replace", - "path" : "/paths/~1{dataset}~1{version}~1records/post/responses/200/content/application~1json/schema/items/additionalProperties", + "op" : "add", + "path" : "/paths/~12.0~1repositories~1{username}/get/responses/200/content/application~1json/schema/items/$ref", + "value" : "#/components/schemas/repository" +}, { + "op" : "add", + "path" : "/paths/~12.0~1repositories~1{username}/get/responses/200/links", + "value" : { + "userRepository" : { + "$ref" : "#/components/links/UserRepository" + } + } +}, { + "op" : "add", + "path" : "/paths/~12.0~1users~1{username}/get/responses/200/content/application~1json/schema/$ref", + "value" : "#/components/schemas/user" +}, { + "op" : "add", + "path" : "/paths/~12.0~1users~1{username}/get/responses/200/links", + "value" : { + "userRepositories" : { + "$ref" : "#/components/links/UserRepositories" + } + } +}, { + "op" : "add", + "path" : "/paths/~12.0~1repositories~1{username}~1{slug}~1pullrequests~1{pid}/get/responses/200/content/application~1json/schema/$ref", + "value" : "#/components/schemas/pullrequest" +}, { + "op" : "add", + "path" : "/paths/~12.0~1repositories~1{username}~1{slug}~1pullrequests~1{pid}/get/responses/200/links", + "value" : { + "pullRequestMerge" : { + "$ref" : "#/components/links/PullRequestMerge" + } + } +}, { + "op" : "remove", + "path" : "/paths/~12.0~1repositories~1{username}~1{slug}~1pullrequests/get/parameters/2/required" +}, { + "op" : "add", + "path" : "/paths/~12.0~1repositories~1{username}~1{slug}~1pullrequests/get/parameters/2/schema/enum", + "value" : [ "open", "merged", "declined" ] +}, { + "op" : "add", + "path" : "/paths/~12.0~1repositories~1{username}~1{slug}~1pullrequests/get/responses/200/content/application~1json/schema/items/$ref", + "value" : "#/components/schemas/pullrequest" +}, { + "op" : "add", + "path" : "/paths/~12.0~1repositories~1{username}~1{slug}/get/responses/200/content/application~1json/schema/$ref", + "value" : "#/components/schemas/repository" +}, { + "op" : "add", + "path" : "/paths/~12.0~1repositories~1{username}~1{slug}/get/responses/200/links", "value" : { - "type" : "object" + "repositoryPullRequests" : { + "$ref" : "#/components/links/RepositoryPullRequests" + } } +}, { + "op" : "remove", + "path" : "/components/links/UserRepositories/operationRef" +}, { + "op" : "remove", + "path" : "/components/links/UserRepository/operationRef" +}, { + "op" : "remove", + "path" : "/components/links/PullRequestMerge/operationRef" +}, { + "op" : "remove", + "path" : "/components/links/RepositoryPullRequests/operationRef" +}, { + "op" : "add", + "path" : "/components/schemas/pullrequest/properties/author/$ref", + "value" : "#/components/schemas/user" +}, { + "op" : "add", + "path" : "/components/schemas/pullrequest/properties/repository/$ref", + "value" : "#/components/schemas/repository" }, { "op" : "add", - "path" : "/paths/~1/get/responses/200/content/application~1json/schema/$ref", - "value" : "#/components/schemas/dataSetList" + "path" : "/components/schemas/repository/properties/owner/$ref", + "value" : "#/components/schemas/user" } ] ==> expected: <{ - "openapi" : "3.0.1", + "openapi" : "3.0.0", "info" : { - "contact" : { - "email" : "developer@uspto.gov", - "name" : "Open Data Portal", - "url" : "https://developer.uspto.gov" - }, - "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.", - "title" : "USPTO Data Set API", + "title" : "Link Example", "version" : "1.0.0" }, - "servers" : [ { - "url" : "{scheme}://developer.uspto.gov/ds-api", - "variables" : { - "scheme" : { - "description" : "The Data Set API is accessible via https and http", - "default" : "https", - "enum" : [ "https", "http" ] - } - } - } ], - "tags" : [ { - "name" : "metadata", - "description" : "Find out about the data sets" - }, { - "name" : "search", - "description" : "Search a data set" - } ], "paths" : { - "/" : { + "/2.0/users/{username}" : { + "get" : { + "operationId" : "getUserByName", + "parameters" : [ { + "required" : true, + "schema" : { + "type" : "string" + }, + "in" : "path", + "name" : "username" + } ], + "responses" : { + "200" : { + "description" : "The User", + "links" : { + "userRepositories" : { + "$ref" : "#/components/links/UserRepositories" + } + }, + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/user" + } + } + } + } + } + } + }, + "/2.0/repositories/{username}" : { "get" : { - "tags" : [ "metadata" ], - "summary" : "List available data sets", - "operationId" : "list-data-sets", + "operationId" : "getRepositoriesByOwner", + "parameters" : [ { + "required" : true, + "schema" : { + "type" : "string" + }, + "in" : "path", + "name" : "username" + } ], "responses" : { "200" : { - "description" : "Returns a list of data sets", + "description" : "repositories owned by the supplied user", + "links" : { + "userRepository" : { + "$ref" : "#/components/links/UserRepository" + } + }, "content" : { "application/json" : { - "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" - } ] - }, "schema" : { - "$ref" : "#/components/schemas/dataSetList" + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/repository" + } } } } @@ -76,48 +156,78 @@ } } }, - "/{dataset}/{version}/fields" : { + "/2.0/repositories/{username}/{slug}" : { "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", + "operationId" : "getRepository", "parameters" : [ { - "description" : "Name of the dataset.", - "example" : "oa_citations", "required" : true, "schema" : { "type" : "string" }, "in" : "path", - "name" : "dataset" + "name" : "username" }, { - "description" : "Version of the dataset.", - "example" : "v1", "required" : true, "schema" : { "type" : "string" }, "in" : "path", - "name" : "version" + "name" : "slug" } ], "responses" : { "200" : { - "description" : "The dataset API for the given version is found and it is accessible to consume.", + "description" : "The repository", + "links" : { + "repositoryPullRequests" : { + "$ref" : "#/components/links/RepositoryPullRequests" + } + }, "content" : { "application/json" : { "schema" : { - "type" : "string" + "$ref" : "#/components/schemas/repository" } } } + } + } + } + }, + "/2.0/repositories/{username}/{slug}/pullrequests" : { + "get" : { + "operationId" : "getPullRequestsByRepository", + "parameters" : [ { + "required" : true, + "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.", + "in" : "path", + "name" : "username" + }, { + "required" : true, + "schema" : { + "type" : "string" + }, + "in" : "path", + "name" : "slug" + }, { + "schema" : { + "type" : "string", + "enum" : [ "open", "merged", "declined" ] + }, + "in" : "query", + "name" : "state" + } ], + "responses" : { + "200" : { + "description" : "an array of pull request objects", "content" : { "application/json" : { "schema" : { - "type" : "string" + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/pullrequest" + } } } } @@ -125,114 +235,150 @@ } } }, - "/{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", + "/2.0/repositories/{username}/{slug}/pullrequests/{pid}" : { + "get" : { + "operationId" : "getPullRequestsById", "parameters" : [ { - "description" : "Version of the dataset.", "required" : true, "schema" : { - "type" : "string", - "default" : "v1" + "type" : "string" }, "in" : "path", - "name" : "version" + "name" : "username" }, { - "description" : "Name of the dataset. In this case, the default value is oa_citations", "required" : true, "schema" : { - "type" : "string", - "default" : "oa_citations" + "type" : "string" }, "in" : "path", - "name" : "dataset" + "name" : "slug" + }, { + "required" : true, + "schema" : { + "type" : "string" + }, + "in" : "path", + "name" : "pid" } ], - "requestBody" : { - "content" : { - "application/x-www-form-urlencoded" : { - "schema" : { - "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 - } - }, - "type" : "object", - "required" : [ "criteria" ] - } - } - } - }, "responses" : { "200" : { - "description" : "successful operation", + "description" : "a pull request object", + "links" : { + "pullRequestMerge" : { + "$ref" : "#/components/links/PullRequestMerge" + } + }, "content" : { "application/json" : { "schema" : { - "type" : "array", - "items" : { - "type" : "object", - "additionalProperties" : { - "type" : "object" - } - } + "$ref" : "#/components/schemas/pullrequest" } } } + } + } + } + }, + "/2.0/repositories/{username}/{slug}/pullrequests/{pid}/merge" : { + "post" : { + "operationId" : "mergePullRequest", + "parameters" : [ { + "required" : true, + "schema" : { + "type" : "string" + }, + "in" : "path", + "name" : "username" + }, { + "required" : true, + "schema" : { + "type" : "string" + }, + "in" : "path", + "name" : "slug" + }, { + "required" : true, + "schema" : { + "type" : "string" }, - "404" : { - "description" : "No matching record found for the given criteria." + "in" : "path", + "name" : "pid" + } ], + "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" : { - "dataSetList" : { + "user" : { "properties" : { - "total" : { + "username" : { + "type" : "string" + }, + "uuid" : { + "type" : "string" + } + }, + "type" : "object" + }, + "repository" : { + "properties" : { + "slug" : { + "type" : "string" + }, + "owner" : { + "$ref" : "#/components/schemas/user" + } + }, + "type" : "object" + }, + "pullrequest" : { + "properties" : { + "id" : { "type" : "integer" }, - "apis" : { - "type" : "array", - "items" : { - "properties" : { - "apiKey" : { - "description" : "To be used as a dataset parameter value", - "type" : "string" - }, - "apiVersionNumber" : { - "description" : "To be used as a version parameter value", - "type" : "string" - }, - "apiUrl" : { - "description" : "The URL describing the dataset's fields", - "format" : "uriref", - "type" : "string" - }, - "apiDocumentationUrl" : { - "description" : "A URL to the API console for each API", - "format" : "uriref", - "type" : "string" - } - }, - "type" : "object" - } + "title" : { + "type" : "string" + }, + "repository" : { + "$ref" : "#/components/schemas/repository" + }, + "author" : { + "$ref" : "#/components/schemas/user" } }, "type" : "object" @@ -240,150 +386,163 @@ } } }> but was: <{ - "openapi" : "3.0.1", + "openapi" : "3.0.0", "info" : { - "contact" : { - "email" : "developer@uspto.gov", - "name" : "Open Data Portal", - "url" : "https://developer.uspto.gov" - }, - "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.", - "title" : "USPTO Data Set API", + "title" : "Link Example", "version" : "1.0.0" }, - "servers" : [ { - "url" : "{scheme}://developer.uspto.gov/ds-api", - "variables" : { - "scheme" : { - "description" : "The Data Set API is accessible via https and http", - "default" : "https", - "enum" : [ "https", "http" ] - } - } - } ], - "tags" : [ { - "name" : "metadata", - "description" : "Find out about the data sets" - }, { - "name" : "search", - "description" : "Search a data set" - } ], "paths" : { - "/{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", + "/2.0/repositories/{username}" : { + "get" : { + "operationId" : "getRepositoriesByOwner", "parameters" : [ { - "description" : "Version of the dataset.", - "required" : true, - "schema" : { - "type" : "string", - "default" : "v1" - }, - "in" : "path", - "name" : "version" - }, { - "description" : "Name of the dataset. In this case, the default value is oa_citations", "required" : true, "schema" : { - "type" : "string", - "default" : "oa_citations" + "type" : "string" }, "in" : "path", - "name" : "dataset" + "name" : "username" } ], - "requestBody" : { - "content" : { - "application/x-www-form-urlencoded" : { - "schema" : { - "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 - } - }, - "type" : "object", - "required" : [ "criteria" ] - } - } - } - }, "responses" : { "200" : { - "description" : "successful operation", + "description" : "repositories owned by the supplied user", "content" : { "application/json" : { "schema" : { "type" : "array", - "items" : { - "type" : "object", - "additionalProperties" : false - } + "items" : { } } } } + } + } + } + }, + "/2.0/users/{username}" : { + "get" : { + "operationId" : "getUserByName", + "parameters" : [ { + "required" : true, + "schema" : { + "type" : "string" }, - "404" : { - "description" : "No matching record found for the given criteria." + "in" : "path", + "name" : "username" + } ], + "responses" : { + "200" : { + "description" : "The User", + "content" : { + "application/json" : { + "schema" : { } + } + } } } } }, - "/{dataset}/{version}/fields" : { + "/2.0/repositories/{username}/{slug}/pullrequests/{pid}" : { "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", + "operationId" : "getPullRequestsById", "parameters" : [ { - "description" : "Name of the dataset.", - "example" : "oa_citations", "required" : true, "schema" : { "type" : "string" }, "in" : "path", - "name" : "dataset" + "name" : "username" + }, { + "required" : true, + "schema" : { + "type" : "string" + }, + "in" : "path", + "name" : "slug" }, { - "description" : "Version of the dataset.", - "example" : "v1", "required" : true, "schema" : { "type" : "string" }, "in" : "path", - "name" : "version" + "name" : "pid" } ], "responses" : { "200" : { - "description" : "The dataset API for the given version is found and it is accessible to consume.", + "description" : "a pull request object", "content" : { "application/json" : { - "schema" : { - "type" : "string" - } + "schema" : { } } } + } + } + } + }, + "/2.0/repositories/{username}/{slug}/pullrequests/{pid}/merge" : { + "post" : { + "operationId" : "mergePullRequest", + "parameters" : [ { + "required" : true, + "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.", + "in" : "path", + "name" : "username" + }, { + "required" : true, + "schema" : { + "type" : "string" + }, + "in" : "path", + "name" : "slug" + }, { + "required" : true, + "schema" : { + "type" : "string" + }, + "in" : "path", + "name" : "pid" + } ], + "responses" : { + "204" : { + "description" : "the PR was successfully merged" + } + } + } + }, + "/2.0/repositories/{username}/{slug}/pullrequests" : { + "get" : { + "operationId" : "getPullRequestsByRepository", + "parameters" : [ { + "required" : true, + "schema" : { + "type" : "string" + }, + "in" : "path", + "name" : "username" + }, { + "required" : true, + "schema" : { + "type" : "string" + }, + "in" : "path", + "name" : "slug" + }, { + "required" : false, + "schema" : { + "type" : "string" + }, + "in" : "query", + "name" : "state" + } ], + "responses" : { + "200" : { + "description" : "an array of pull request objects", "content" : { "application/json" : { "schema" : { - "type" : "string" + "type" : "array", + "items" : { } } } } @@ -391,30 +550,29 @@ } } }, - "/" : { + "/2.0/repositories/{username}/{slug}" : { "get" : { - "tags" : [ "metadata" ], - "summary" : "List available data sets", - "operationId" : "list-data-sets", + "operationId" : "getRepository", + "parameters" : [ { + "required" : true, + "schema" : { + "type" : "string" + }, + "in" : "path", + "name" : "username" + }, { + "required" : true, + "schema" : { + "type" : "string" + }, + "in" : "path", + "name" : "slug" + } ], "responses" : { "200" : { - "description" : "Returns a list of data sets", + "description" : "The repository", "content" : { "application/json" : { - "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" - } ] - }, "schema" : { } } } @@ -424,37 +582,70 @@ } }, "components" : { + "links" : { + "UserRepositories" : { + "operationId" : "getRepositoriesByOwner", + "operationRef" : "", + "parameters" : { + "username" : "$response.body#/username" + } + }, + "UserRepository" : { + "operationId" : "getRepository", + "operationRef" : "", + "parameters" : { + "slug" : "$response.body#/slug", + "username" : "$response.body#/owner/username" + } + }, + "PullRequestMerge" : { + "operationId" : "mergePullRequest", + "operationRef" : "", + "parameters" : { + "pid" : "$response.body#/id", + "slug" : "$response.body#/repository/slug", + "username" : "$response.body#/author/username" + } + }, + "RepositoryPullRequests" : { + "operationId" : "getPullRequestsByRepository", + "operationRef" : "", + "parameters" : { + "slug" : "$response.body#/slug", + "username" : "$response.body#/owner/username" + } + } + }, "schemas" : { - "dataSetList" : { + "pullrequest" : { "properties" : { - "total" : { + "author" : { }, + "id" : { "type" : "integer" }, - "apis" : { - "type" : "array", - "items" : { - "properties" : { - "apiKey" : { - "description" : "To be used as a dataset parameter value", - "type" : "string" - }, - "apiUrl" : { - "description" : "The URL describing the dataset's fields", - "format" : "uriref", - "type" : "string" - }, - "apiDocumentationUrl" : { - "description" : "A URL to the API console for each API", - "format" : "uriref", - "type" : "string" - }, - "apiVersionNumber" : { - "description" : "To be used as a version parameter value", - "type" : "string" - } - }, - "type" : "object" - } + "title" : { + "type" : "string" + }, + "repository" : { } + }, + "type" : "object" + }, + "repository" : { + "properties" : { + "owner" : { }, + "slug" : { + "type" : "string" + } + }, + "type" : "object" + }, + "user" : { + "properties" : { + "uuid" : { + "type" : "string" + }, + "username" : { + "type" : "string" } }, "type" : "object" @@ -466,8 +657,8 @@ at org.junit.jupiter.api.AssertionUtils.failNotEqual(AssertionUtils.java:62) at org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:182) at org.junit.jupiter.api.Assertions.assertEquals(Assertions.java:1135) - at openapi.OpenAPIMain_test.compareJson(OpenAPIMain_test.java:80) - at openapi.OpenAPIMain_test.test(OpenAPIMain_test.java:67) + at openapi.OpenAPIMain_test.compareJson(OpenAPIMain_test.java:89) + at openapi.OpenAPIMain_test.test(OpenAPIMain_test.java:75) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) @@ -499,7 +690,7 @@ at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73) at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:126) at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:84) - at java.base/java.util.ArrayList.forEach(ArrayList.java:1540) + at java.base/java.util.ArrayList.forEach(ArrayList.java:1541) at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:38) at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:143) at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73) @@ -509,7 +700,7 @@ at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73) at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:126) at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:84) - at java.base/java.util.ArrayList.forEach(ArrayList.java:1540) + at java.base/java.util.ArrayList.forEach(ArrayList.java:1541) at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:38) at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:143) at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73) @@ -557,10 +748,16 @@ at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:56) - at java.base/java.lang.Thread.run(Thread.java:834) + at java.base/java.lang.Thread.run(Thread.java:829) </failure> </testcase> - <system-out><![CDATA[Loading expression DSL file 'uspto.json'. + <system-out><![CDATA[Loading expression DSL file 'api-with-examples.json'. +Is the source object valid? : true +Is the generated object valid? : true +Loading expression DSL file 'callback-example.json'. +Is the source object valid? : true +Is the generated object valid? : true +Loading expression DSL file 'link-example.json'. Is the source object valid? : true Is the generated object valid? : true ]]></system-out> diff --git a/build/test-results/test/binary/output.bin b/build/test-results/test/binary/output.bin index 79960daf973f3c50cfbd13d75bd2fc683e715897..0365021c9053ef0d470390d8d43e106e54b84538 100644 --- a/build/test-results/test/binary/output.bin +++ b/build/test-results/test/binary/output.bin @@ -1,3 +1,9 @@ -+Loading expression DSL file 'uspto.json'. +7Loading expression DSL file 'api-with-examples.json'. +$Is the source object valid? : true +'Is the generated object valid? : true +6Loading expression DSL file 'callback-example.json'. +$Is the source object valid? : true +'Is the generated object valid? : true +2Loading expression DSL file 'link-example.json'. $Is the source object valid? : true 'Is the generated object valid? : true diff --git a/build/test-results/test/binary/output.bin.idx b/build/test-results/test/binary/output.bin.idx index 1ea36ce12fcdab3f36bc26c99688c3f03dec79dc..58ba046e6bca8a95c0f12c61be96602a7f2d7b6b 100644 Binary files a/build/test-results/test/binary/output.bin.idx and b/build/test-results/test/binary/output.bin.idx differ diff --git a/build/test-results/test/binary/results.bin b/build/test-results/test/binary/results.bin index 0ee2879098ca6986fe4716d993e7d832fa6b5ddf..edc20fbccd949f0289a3c76d87dc22222cd4e5ae 100644 Binary files a/build/test-results/test/binary/results.bin and b/build/test-results/test/binary/results.bin differ diff --git a/src/gen/java/de/tudresden/inf/st/openapi/ast/CallbackObject.java b/src/gen/java/de/tudresden/inf/st/openapi/ast/CallbackObject.java index 262460239bf16cb243856455b8b2eea16f2b5a91..701d5736abe8ff2a9f9f139b88ce4bee7c09cc1d 100644 --- a/src/gen/java/de/tudresden/inf/st/openapi/ast/CallbackObject.java +++ b/src/gen/java/de/tudresden/inf/st/openapi/ast/CallbackObject.java @@ -31,7 +31,7 @@ public class CallbackObject extends ASTNode<ASTNode> implements Cloneable { } /** * @aspect Parser - * @declaredat E:\\bachelor-thesis\\SigTest\\bachelor-thesis-jastadd\\src\\main\\jastadd\\Parser.jrag:450 + * @declaredat E:\\bachelor-thesis\\SigTest\\bachelor-thesis-jastadd\\src\\main\\jastadd\\Parser.jrag:514 */ public static CallbackObject parseCallback(Callback callback){ CallbackObject callbackObject = new CallbackObject(); diff --git a/src/gen/java/de/tudresden/inf/st/openapi/ast/ComponentsObject.java b/src/gen/java/de/tudresden/inf/st/openapi/ast/ComponentsObject.java index 172c19d3ac3e2bbb7cfaa1a70528a2678f6b4ec3..8025c0e6a611d6279718d8e9f5faf7fb2888ad35 100644 --- a/src/gen/java/de/tudresden/inf/st/openapi/ast/ComponentsObject.java +++ b/src/gen/java/de/tudresden/inf/st/openapi/ast/ComponentsObject.java @@ -87,30 +87,54 @@ public class ComponentsObject extends ASTNode<ASTNode> implements Cloneable { if( components.getSchemas() != null ){ JastAddList<SchemasTuple> schemasTuples = new JastAddList<>(); for( String key : components.getSchemas().keySet() ){ - SchemaObjectTuple schemaObjectTuple = new SchemaObjectTuple(); - schemaObjectTuple.setName( key ); - schemaObjectTuple.setSchemaObject( SchemaObject.parseSchema(components.getSchema(key)) ); - schemasTuples.add(schemaObjectTuple); + if( components.getSchema(key).isRef() ){ + SchemaReferenceTuple schema = new SchemaReferenceTuple(); + schema.setName(key); + schema.setRef(components.getSchema(key).getRef()); + schemasTuples.add(schema); + } + else { + SchemaObjectTuple schema = new SchemaObjectTuple(); + schema.setName(key); + schema.setSchemaObject(SchemaObject.parseSchema(components.getSchema(key))); + schemasTuples.add(schema); + } } componentsObject.setSchemasTupleList(schemasTuples); } if( components.getResponses() != null ){ JastAddList<ResponsesTuple> responsesTuples = new JastAddList<>(); for( String key : components.getResponses().keySet() ){ - ResponseObjectTuple responseObjectTuple = new ResponseObjectTuple(); - responseObjectTuple.setName( key ); - responseObjectTuple.setResponseObject( ResponseObject.parseResponse(components.getResponse(key)) ); - responsesTuples.add(responseObjectTuple); + if( components.getResponse(key).isRef() ){ + ResponseReferenceTuple response = new ResponseReferenceTuple(); + response.setName(key); + response.setRef(components.getResponse(key).getRef()); + responsesTuples.add(response); + } + else { + ResponseObjectTuple response = new ResponseObjectTuple(); + response.setName(key); + response.setResponseObject(ResponseObject.parseResponse(components.getResponse(key))); + responsesTuples.add(response); + } } componentsObject.setResponsesTupleList(responsesTuples); } if( components.getParameters() != null ){ JastAddList<ParameterTuple> parameterTuples = new JastAddList<>(); for( String key : components.getParameters().keySet() ){ - ParameterObjectTuple parameterObjectTuple = new ParameterObjectTuple(); - parameterObjectTuple.setName( key ); - parameterObjectTuple.setParameterObject( ParameterObject.parseParameter(components.getParameter(key)) ); - parameterTuples.add(parameterObjectTuple); + if( components.getParameter(key).isRef() ){ + ParameterReferenceTuple parameter = new ParameterReferenceTuple(); + parameter.setName(key); + parameter.setRef(components.getParameter(key).getRef()); + parameterTuples.add(parameter); + } + else { + ParameterObjectTuple parameter = new ParameterObjectTuple(); + parameter.setName(key); + parameter.setParameterObject(ParameterObject.parseParameter(components.getParameter(key))); + parameterTuples.add(parameter); + } } componentsObject.setParameterTupleList(parameterTuples); } @@ -127,50 +151,90 @@ public class ComponentsObject extends ASTNode<ASTNode> implements Cloneable { if( components.getRequestBodies() != null ){ JastAddList<RequestBodiesTuple> requestBodiesTuples = new JastAddList<>(); for( String key : components.getRequestBodies().keySet() ){ - RequestBodyObjectTuple requestBodyObjectTuple = new RequestBodyObjectTuple(); - requestBodyObjectTuple.setName( key ); - requestBodyObjectTuple.setRequestBodyObject( RequestBodyObject.parseRequestBody(components.getRequestBody(key)) ); - requestBodiesTuples.add(requestBodyObjectTuple); + if( components.getRequestBody(key).isRef() ){ + RequestBodyReferenceTuple requestBody = new RequestBodyReferenceTuple(); + requestBody.setName(key); + requestBody.setRef(components.getRequestBody(key).getRef()); + requestBodiesTuples.add(requestBody); + } + else { + RequestBodyObjectTuple requestBody = new RequestBodyObjectTuple(); + requestBody.setName(key); + requestBody.setRequestBodyObject(RequestBodyObject.parseRequestBody(components.getRequestBody(key))); + requestBodiesTuples.add(requestBody); + } } componentsObject.setRequestBodiesTupleList(requestBodiesTuples); } if( components.getHeaders() != null ){ JastAddList<HeadersTuple> headersTuples = new JastAddList<>(); for( String key : components.getHeaders().keySet() ){ - HeaderObjectTuple headerObjectTuple = new HeaderObjectTuple(); - headerObjectTuple.setName( key ); - headerObjectTuple.setHeaderObject( HeaderObject.parseHeader(components.getHeader(key)) ); - headersTuples.add(headerObjectTuple); + if( components.getHeader(key).isRef() ){ + HeaderReferenceTuple header = new HeaderReferenceTuple(); + header.setName(key); + header.setRef(components.getHeader(key).getRef()); + headersTuples.add(header); + } + else { + HeaderObjectTuple header = new HeaderObjectTuple(); + header.setName(key); + header.setHeaderObject(HeaderObject.parseHeader(components.getHeader(key))); + headersTuples.add(header); + } } componentsObject.setHeadersTupleList(headersTuples); } if( components.getSecuritySchemes() != null ){ JastAddList<SecuritySchemesTuple> securitySchemesTuples = new JastAddList<>(); for( String key : components.getSecuritySchemes().keySet() ){ - SecuritySchemeObjectTuple securitySchemeObjectTuple = new SecuritySchemeObjectTuple(); - securitySchemeObjectTuple.setName( key ); - securitySchemeObjectTuple.setSecuritySchemeObject( SecuritySchemeObject.parseSecurityScheme(components.getSecurityScheme(key)) ); - securitySchemesTuples.add(securitySchemeObjectTuple); + if( components.getSecurityScheme(key).isRef() ){ + SecuritySchemeReferenceTuple securityScheme = new SecuritySchemeReferenceTuple(); + securityScheme.setName(key); + securityScheme.setRef(components.getSecurityScheme(key).getRef()); + securitySchemesTuples.add(securityScheme); + } + else { + SecuritySchemeObjectTuple securityScheme = new SecuritySchemeObjectTuple(); + securityScheme.setName(key); + securityScheme.setSecuritySchemeObject(SecuritySchemeObject.parseSecurityScheme(components.getSecurityScheme(key))); + securitySchemesTuples.add(securityScheme); + } } componentsObject.setSecuritySchemesTupleList(securitySchemesTuples); } if( components.getLinks() != null ){ JastAddList<LinksTuple> linksTuples = new JastAddList<>(); for( String key : components.getLinks().keySet() ){ - LinkObjectTuple linkObjectTuple = new LinkObjectTuple(); - linkObjectTuple.setName( key ); - linkObjectTuple.setLinkObject( LinkObject.parseLink(components.getLink(key)) ); - linksTuples.add(linkObjectTuple); + if( components.getLink(key).isRef() ){ + LinkReferenceTuple link = new LinkReferenceTuple(); + link.setName(key); + link.setRef(components.getLink(key).getRef()); + linksTuples.add(link); + } + else { + LinkObjectTuple link = new LinkObjectTuple(); + link.setName(key); + link.setLinkObject(LinkObject.parseLink(components.getLink(key))); + linksTuples.add(link); + } } componentsObject.setLinksTupleList(linksTuples); } if( components.getCallbacks() != null ){ JastAddList<CallbacksTuple> callbacksTuples = new JastAddList<>(); for( String key : components.getCallbacks().keySet() ){ - CallbackObjectTuple callbackObjectTuple = new CallbackObjectTuple(); - callbackObjectTuple.setName( key ); - callbackObjectTuple.setCallbackObject( CallbackObject.parseCallback(components.getCallback(key)) ); - callbacksTuples.add(callbackObjectTuple); + if( components.getCallback(key).isRef() ){ + CallbackReferenceTuple callback = new CallbackReferenceTuple(); + callback.setName(key); + callback.setRef(components.getLink(key).getRef()); + callbacksTuples.add(callback); + } + else { + CallbackObjectTuple callback = new CallbackObjectTuple(); + callback.setName(key); + callback.setCallbackObject(CallbackObject.parseCallback(components.getCallback(key))); + callbacksTuples.add(callback); + } } componentsObject.setCallbacksTupleList(callbacksTuples); } diff --git a/src/gen/java/de/tudresden/inf/st/openapi/ast/DiscriminatorObject.java b/src/gen/java/de/tudresden/inf/st/openapi/ast/DiscriminatorObject.java index e06ee03221824a46dcd7571f35a50e9cc56b0c32..6867aae5fe120572505d9da246aa2e1c95f57d65 100644 --- a/src/gen/java/de/tudresden/inf/st/openapi/ast/DiscriminatorObject.java +++ b/src/gen/java/de/tudresden/inf/st/openapi/ast/DiscriminatorObject.java @@ -33,7 +33,7 @@ public class DiscriminatorObject extends ASTNode<ASTNode> implements Cloneable { } /** * @aspect Parser - * @declaredat E:\\bachelor-thesis\\SigTest\\bachelor-thesis-jastadd\\src\\main\\jastadd\\Parser.jrag:653 + * @declaredat E:\\bachelor-thesis\\SigTest\\bachelor-thesis-jastadd\\src\\main\\jastadd\\Parser.jrag:717 */ public static DiscriminatorObject parseDiscriminator (Discriminator discriminator) { DiscriminatorObject discriminatorObject = new DiscriminatorObject(); diff --git a/src/gen/java/de/tudresden/inf/st/openapi/ast/EncodingObject.java b/src/gen/java/de/tudresden/inf/st/openapi/ast/EncodingObject.java index e38ce2f4b327d3d8046dcc56549fef63638fa5c1..9398b46d4e5023fd9a937993e1f10d3acdc79503 100644 --- a/src/gen/java/de/tudresden/inf/st/openapi/ast/EncodingObject.java +++ b/src/gen/java/de/tudresden/inf/st/openapi/ast/EncodingObject.java @@ -37,7 +37,7 @@ public class EncodingObject extends ASTNode<ASTNode> implements Cloneable { } /** * @aspect Parser - * @declaredat E:\\bachelor-thesis\\SigTest\\bachelor-thesis-jastadd\\src\\main\\jastadd\\Parser.jrag:411 + * @declaredat E:\\bachelor-thesis\\SigTest\\bachelor-thesis-jastadd\\src\\main\\jastadd\\Parser.jrag:475 */ public static EncodingObject parseEncoding(EncodingProperty encodingProperty){ EncodingObject encodingObject = new EncodingObject(); diff --git a/src/gen/java/de/tudresden/inf/st/openapi/ast/ExampleObject.java b/src/gen/java/de/tudresden/inf/st/openapi/ast/ExampleObject.java index 3a8615bba1eed890e1c1b03f5d68947d6930700a..862d11bd95f8915b79ae6ee527e1ea57b4c8b99e 100644 --- a/src/gen/java/de/tudresden/inf/st/openapi/ast/ExampleObject.java +++ b/src/gen/java/de/tudresden/inf/st/openapi/ast/ExampleObject.java @@ -33,7 +33,7 @@ public class ExampleObject extends ASTNode<ASTNode> implements Cloneable { } /** * @aspect Parser - * @declaredat E:\\bachelor-thesis\\SigTest\\bachelor-thesis-jastadd\\src\\main\\jastadd\\Parser.jrag:461 + * @declaredat E:\\bachelor-thesis\\SigTest\\bachelor-thesis-jastadd\\src\\main\\jastadd\\Parser.jrag:525 */ public static ExampleObject parseExample(Example example){ ExampleObject exampleObject = new ExampleObject(); diff --git a/src/gen/java/de/tudresden/inf/st/openapi/ast/ExternalDocumentationObject.java b/src/gen/java/de/tudresden/inf/st/openapi/ast/ExternalDocumentationObject.java index 811bc27dd7478c630dd078da0893f1ec3e736a45..466b4f51e017d78f4be169eba04a59348a2b1f10 100644 --- a/src/gen/java/de/tudresden/inf/st/openapi/ast/ExternalDocumentationObject.java +++ b/src/gen/java/de/tudresden/inf/st/openapi/ast/ExternalDocumentationObject.java @@ -28,7 +28,7 @@ public class ExternalDocumentationObject extends ASTNode<ASTNode> implements Clo } /** * @aspect Parser - * @declaredat E:\\bachelor-thesis\\SigTest\\bachelor-thesis-jastadd\\src\\main\\jastadd\\Parser.jrag:331 + * @declaredat E:\\bachelor-thesis\\SigTest\\bachelor-thesis-jastadd\\src\\main\\jastadd\\Parser.jrag:395 */ public static ExternalDocumentationObject parseExternalDocs(ExternalDocs externalDocs){ ExternalDocumentationObject externalDocumentationObject = new ExternalDocumentationObject(); diff --git a/src/gen/java/de/tudresden/inf/st/openapi/ast/HeaderObject.java b/src/gen/java/de/tudresden/inf/st/openapi/ast/HeaderObject.java index f6191a9f28a28613a7524a8aab2743f1d343459c..88fcbf8fd71fd082f8b8fa90d8b302eb6ed6ea72 100644 --- a/src/gen/java/de/tudresden/inf/st/openapi/ast/HeaderObject.java +++ b/src/gen/java/de/tudresden/inf/st/openapi/ast/HeaderObject.java @@ -49,7 +49,7 @@ public class HeaderObject extends ASTNode<ASTNode> implements Cloneable { } /** * @aspect Parser - * @declaredat E:\\bachelor-thesis\\SigTest\\bachelor-thesis-jastadd\\src\\main\\jastadd\\Parser.jrag:495 + * @declaredat E:\\bachelor-thesis\\SigTest\\bachelor-thesis-jastadd\\src\\main\\jastadd\\Parser.jrag:559 */ public static HeaderObject parseHeader(Header header){ HeaderObject headerObject = new HeaderObject(); diff --git a/src/gen/java/de/tudresden/inf/st/openapi/ast/LinkObject.java b/src/gen/java/de/tudresden/inf/st/openapi/ast/LinkObject.java index efd18cfccff57567e8da05709cadf8efad302d50..714f5cddf3cfe2eb664a1fe0cac65cc5d303709c 100644 --- a/src/gen/java/de/tudresden/inf/st/openapi/ast/LinkObject.java +++ b/src/gen/java/de/tudresden/inf/st/openapi/ast/LinkObject.java @@ -39,7 +39,7 @@ public class LinkObject extends ASTNode<ASTNode> implements Cloneable { } /** * @aspect Parser - * @declaredat E:\\bachelor-thesis\\SigTest\\bachelor-thesis-jastadd\\src\\main\\jastadd\\Parser.jrag:476 + * @declaredat E:\\bachelor-thesis\\SigTest\\bachelor-thesis-jastadd\\src\\main\\jastadd\\Parser.jrag:540 */ public static LinkObject parseLink(Link link){ LinkObject linkObject = new LinkObject(); diff --git a/src/gen/java/de/tudresden/inf/st/openapi/ast/MediaTypeObject.java b/src/gen/java/de/tudresden/inf/st/openapi/ast/MediaTypeObject.java index db454b4accc519df6449c45fb22b9bd716faf6cd..31449486eee03184a4547e2e8515e38752d62151 100644 --- a/src/gen/java/de/tudresden/inf/st/openapi/ast/MediaTypeObject.java +++ b/src/gen/java/de/tudresden/inf/st/openapi/ast/MediaTypeObject.java @@ -41,7 +41,7 @@ public class MediaTypeObject extends ASTNode<ASTNode> implements Cloneable { } /** * @aspect Parser - * @declaredat E:\\bachelor-thesis\\SigTest\\bachelor-thesis-jastadd\\src\\main\\jastadd\\Parser.jrag:392 + * @declaredat E:\\bachelor-thesis\\SigTest\\bachelor-thesis-jastadd\\src\\main\\jastadd\\Parser.jrag:456 */ public static MediaTypeObject parseMediaType(MediaType mediaType){ MediaTypeObject mediaTypeObject = new MediaTypeObject(); diff --git a/src/gen/java/de/tudresden/inf/st/openapi/ast/OAuthFlowObject.java b/src/gen/java/de/tudresden/inf/st/openapi/ast/OAuthFlowObject.java index ec98aff41b63dc8fd63b4e2cbb879d33661b86d6..599f6a611fad0174194501a4882cedbe2006c2ba 100644 --- a/src/gen/java/de/tudresden/inf/st/openapi/ast/OAuthFlowObject.java +++ b/src/gen/java/de/tudresden/inf/st/openapi/ast/OAuthFlowObject.java @@ -34,7 +34,7 @@ public class OAuthFlowObject extends ASTNode<ASTNode> implements Cloneable { } /** * @aspect Parser - * @declaredat E:\\bachelor-thesis\\SigTest\\bachelor-thesis-jastadd\\src\\main\\jastadd\\Parser.jrag:731 + * @declaredat E:\\bachelor-thesis\\SigTest\\bachelor-thesis-jastadd\\src\\main\\jastadd\\Parser.jrag:795 */ public static OAuthFlowObject parseOAuthFlow(OAuthFlow oAuthFlow){ OAuthFlowObject oAuthFlowObject = new OAuthFlowObject(); diff --git a/src/gen/java/de/tudresden/inf/st/openapi/ast/OAuthFlowsObject.java b/src/gen/java/de/tudresden/inf/st/openapi/ast/OAuthFlowsObject.java index 01b96bdd27545d0571117c6d41e8434c2db39500..d16afb3dee8d1f3c6169c34fb87b8a5d8f415956 100644 --- a/src/gen/java/de/tudresden/inf/st/openapi/ast/OAuthFlowsObject.java +++ b/src/gen/java/de/tudresden/inf/st/openapi/ast/OAuthFlowsObject.java @@ -33,7 +33,7 @@ public class OAuthFlowsObject extends ASTNode<ASTNode> implements Cloneable { } /** * @aspect Parser - * @declaredat E:\\bachelor-thesis\\SigTest\\bachelor-thesis-jastadd\\src\\main\\jastadd\\Parser.jrag:707 + * @declaredat E:\\bachelor-thesis\\SigTest\\bachelor-thesis-jastadd\\src\\main\\jastadd\\Parser.jrag:771 */ public static OAuthFlowsObject parseOAuthFlows(OAuthFlows oAuthFlows){ OAuthFlowsObject oAuthFlowsObject = new OAuthFlowsObject(); diff --git a/src/gen/java/de/tudresden/inf/st/openapi/ast/OpenAPIObject.java b/src/gen/java/de/tudresden/inf/st/openapi/ast/OpenAPIObject.java index a71bc4241989fe4b433d75198d6c5db8b35e16b3..13e13134a07c53ca4f805e44923d511d426f740c 100644 --- a/src/gen/java/de/tudresden/inf/st/openapi/ast/OpenAPIObject.java +++ b/src/gen/java/de/tudresden/inf/st/openapi/ast/OpenAPIObject.java @@ -40,7 +40,7 @@ public class OpenAPIObject extends ASTNode<ASTNode> implements Cloneable { if( openAPIObject.getNumSecurityRequirementObject() != 0 ){ List<SecurityRequirement> securityRequirements = new ArrayList<>(); for( SecurityRequirementObject s : openAPIObject.getSecurityRequirementObjects() ) - securityRequirements.add( SecurityRequirementObject.composeSecurityRequiremnet( s ) ); + securityRequirements.add( SecurityRequirementObject.composeSecurityRequirement( s ) ); api3.setSecurityRequirements(securityRequirements); } if( openAPIObject.getNumTagObject() != 0 ){ diff --git a/src/gen/java/de/tudresden/inf/st/openapi/ast/OperationObject.java b/src/gen/java/de/tudresden/inf/st/openapi/ast/OperationObject.java index 2c98ffaa1deaafb983bb3624b67321d827910855..d6247991a942e63c826290f2532854b9256c84e9 100644 --- a/src/gen/java/de/tudresden/inf/st/openapi/ast/OperationObject.java +++ b/src/gen/java/de/tudresden/inf/st/openapi/ast/OperationObject.java @@ -54,7 +54,7 @@ public class OperationObject extends ASTNode<ASTNode> implements Cloneable { // operation.setDeprecated( (boolean) operationObject.getDeprecatedBoolean().getDeprecatedBoolean() ); if( operationObject.getNumSecurityRequirementObject() != 0 ){ for( SecurityRequirementObject s : operationObject.getSecurityRequirementObjects() ) - operation.addSecurityRequirement( SecurityRequirementObject.composeSecurityRequiremnet(s) ); + operation.addSecurityRequirement( SecurityRequirementObject.composeSecurityRequirement(s) ); } if( operationObject.getNumServerObject() != 0 ){ for( ServerObject s : operationObject.getServerObjects() ) @@ -65,7 +65,7 @@ public class OperationObject extends ASTNode<ASTNode> implements Cloneable { } /** * @aspect Parser - * @declaredat E:\\bachelor-thesis\\SigTest\\bachelor-thesis-jastadd\\src\\main\\jastadd\\Parser.jrag:272 + * @declaredat E:\\bachelor-thesis\\SigTest\\bachelor-thesis-jastadd\\src\\main\\jastadd\\Parser.jrag:336 */ public static OperationObject parseOperation(Operation operation){ OperationObject operationObject = new OperationObject(); diff --git a/src/gen/java/de/tudresden/inf/st/openapi/ast/ParameterObject.java b/src/gen/java/de/tudresden/inf/st/openapi/ast/ParameterObject.java index 95fdda9ac8952862ba39f555a49069e648f03fc4..b697fa64b9963802bf2dcf7a6e110a8e35ebb145 100644 --- a/src/gen/java/de/tudresden/inf/st/openapi/ast/ParameterObject.java +++ b/src/gen/java/de/tudresden/inf/st/openapi/ast/ParameterObject.java @@ -57,7 +57,7 @@ public class ParameterObject extends Param implements Cloneable { } /** * @aspect Parser - * @declaredat E:\\bachelor-thesis\\SigTest\\bachelor-thesis-jastadd\\src\\main\\jastadd\\Parser.jrag:341 + * @declaredat E:\\bachelor-thesis\\SigTest\\bachelor-thesis-jastadd\\src\\main\\jastadd\\Parser.jrag:405 */ public static ParameterObject parseParameter(Parameter parameter){ ParameterObject parameterObject = new ParameterObject(); diff --git a/src/gen/java/de/tudresden/inf/st/openapi/ast/PathItemObject.java b/src/gen/java/de/tudresden/inf/st/openapi/ast/PathItemObject.java index 0e66a4310da7c5b583f1d5f3eec166d6f0605270..41c0325d4cc6f46884cde2f24633519571d5f55e 100644 --- a/src/gen/java/de/tudresden/inf/st/openapi/ast/PathItemObject.java +++ b/src/gen/java/de/tudresden/inf/st/openapi/ast/PathItemObject.java @@ -51,7 +51,7 @@ public class PathItemObject extends ASTNode<ASTNode> implements Cloneable { } /** * @aspect Parser - * @declaredat E:\\bachelor-thesis\\SigTest\\bachelor-thesis-jastadd\\src\\main\\jastadd\\Parser.jrag:211 + * @declaredat E:\\bachelor-thesis\\SigTest\\bachelor-thesis-jastadd\\src\\main\\jastadd\\Parser.jrag:275 */ public static PathItemObject parsePath(Path path){ PathItemObject pathItemObject = new PathItemObject(); diff --git a/src/gen/java/de/tudresden/inf/st/openapi/ast/PathsObject.java b/src/gen/java/de/tudresden/inf/st/openapi/ast/PathsObject.java index 3d95b06bf563bf4a5b6e4f58116596fa614bbad0..19d321369e338e26e156c9268b21795bac05f2ce 100644 --- a/src/gen/java/de/tudresden/inf/st/openapi/ast/PathsObject.java +++ b/src/gen/java/de/tudresden/inf/st/openapi/ast/PathsObject.java @@ -15,7 +15,7 @@ import java.util.*; public class PathsObject extends ASTNode<ASTNode> implements Cloneable { /** * @aspect Parser - * @declaredat E:\\bachelor-thesis\\SigTest\\bachelor-thesis-jastadd\\src\\main\\jastadd\\Parser.jrag:200 + * @declaredat E:\\bachelor-thesis\\SigTest\\bachelor-thesis-jastadd\\src\\main\\jastadd\\Parser.jrag:264 */ public static PathsObject parsePaths(OpenApi3 api3){ PathsObject pathsObject = new PathsObject(); diff --git a/src/gen/java/de/tudresden/inf/st/openapi/ast/RequestBodyObject.java b/src/gen/java/de/tudresden/inf/st/openapi/ast/RequestBodyObject.java index 1c94dfa1153d8a914aabc03335cb16f7a41719e5..f354390da9835fd0cabcbd3f03f6487d11562bc4 100644 --- a/src/gen/java/de/tudresden/inf/st/openapi/ast/RequestBodyObject.java +++ b/src/gen/java/de/tudresden/inf/st/openapi/ast/RequestBodyObject.java @@ -33,7 +33,7 @@ public class RequestBodyObject extends RequestBody implements Cloneable { } /** * @aspect Parser - * @declaredat E:\\bachelor-thesis\\SigTest\\bachelor-thesis-jastadd\\src\\main\\jastadd\\Parser.jrag:377 + * @declaredat E:\\bachelor-thesis\\SigTest\\bachelor-thesis-jastadd\\src\\main\\jastadd\\Parser.jrag:441 */ public static RequestBodyObject parseRequestBody(org.openapi4j.parser.model.v3.RequestBody requestBody){ RequestBodyObject requestBodyObject = new RequestBodyObject(); diff --git a/src/gen/java/de/tudresden/inf/st/openapi/ast/ResponseObject.java b/src/gen/java/de/tudresden/inf/st/openapi/ast/ResponseObject.java index 2866be596169a2592fc5e33e040a06fbe3b3f6f8..1dd9e16e9f3a5dd17293f40bd60070f7ae3c708c 100644 --- a/src/gen/java/de/tudresden/inf/st/openapi/ast/ResponseObject.java +++ b/src/gen/java/de/tudresden/inf/st/openapi/ast/ResponseObject.java @@ -44,7 +44,7 @@ public class ResponseObject extends HTTPStatusCode implements Cloneable { } /** * @aspect Parser - * @declaredat E:\\bachelor-thesis\\SigTest\\bachelor-thesis-jastadd\\src\\main\\jastadd\\Parser.jrag:429 + * @declaredat E:\\bachelor-thesis\\SigTest\\bachelor-thesis-jastadd\\src\\main\\jastadd\\Parser.jrag:493 */ public static ResponseObject parseResponse(Response response){ ResponseObject responseObject = new ResponseObject(); diff --git a/src/gen/java/de/tudresden/inf/st/openapi/ast/SchemaObject.java b/src/gen/java/de/tudresden/inf/st/openapi/ast/SchemaObject.java index c0769034c1f29c1300187b91169821cf50c75b02..edf5a834d1feb89da87386fbee8be3133869758e 100644 --- a/src/gen/java/de/tudresden/inf/st/openapi/ast/SchemaObject.java +++ b/src/gen/java/de/tudresden/inf/st/openapi/ast/SchemaObject.java @@ -107,7 +107,7 @@ public class SchemaObject extends Schema implements Cloneable { } /** * @aspect Parser - * @declaredat E:\\bachelor-thesis\\SigTest\\bachelor-thesis-jastadd\\src\\main\\jastadd\\Parser.jrag:537 + * @declaredat E:\\bachelor-thesis\\SigTest\\bachelor-thesis-jastadd\\src\\main\\jastadd\\Parser.jrag:601 */ public static SchemaObject parseSchema (org.openapi4j.parser.model.v3.Schema schema) { SchemaObject schemaObject = new SchemaObject(); diff --git a/src/gen/java/de/tudresden/inf/st/openapi/ast/SecurityRequirementObject.java b/src/gen/java/de/tudresden/inf/st/openapi/ast/SecurityRequirementObject.java index 92ae5d033c55e41d43da0ef776df4efe9615794c..14251c8c8c2f7af10458c772e954d0225caa3044 100644 --- a/src/gen/java/de/tudresden/inf/st/openapi/ast/SecurityRequirementObject.java +++ b/src/gen/java/de/tudresden/inf/st/openapi/ast/SecurityRequirementObject.java @@ -17,7 +17,7 @@ public class SecurityRequirementObject extends ASTNode<ASTNode> implements Clone * @aspect Composer * @declaredat E:\\bachelor-thesis\\SigTest\\bachelor-thesis-jastadd\\src\\main\\jastadd\\Composer.jadd:660 */ - public static SecurityRequirement composeSecurityRequiremnet (SecurityRequirementObject securityRequirementObject){ + public static SecurityRequirement composeSecurityRequirement (SecurityRequirementObject securityRequirementObject){ SecurityRequirement securityRequirement = new SecurityRequirement(); if( securityRequirementObject.getNumSecurityRequirementTuple() != 0 ){ @@ -35,7 +35,7 @@ public class SecurityRequirementObject extends ASTNode<ASTNode> implements Clone } /** * @aspect Parser - * @declaredat E:\\bachelor-thesis\\SigTest\\bachelor-thesis-jastadd\\src\\main\\jastadd\\Parser.jrag:745 + * @declaredat E:\\bachelor-thesis\\SigTest\\bachelor-thesis-jastadd\\src\\main\\jastadd\\Parser.jrag:809 */ public static SecurityRequirementObject parseSecurityRequirement(SecurityRequirement securityRequirement){ SecurityRequirementObject securityRequirementObject = new SecurityRequirementObject(); diff --git a/src/gen/java/de/tudresden/inf/st/openapi/ast/SecuritySchemeObject.java b/src/gen/java/de/tudresden/inf/st/openapi/ast/SecuritySchemeObject.java index f5eebfa2e5655c854bd940094d7928339cd3d612..c4749a9efcf64420c75b88b8b8d667792fff3d88 100644 --- a/src/gen/java/de/tudresden/inf/st/openapi/ast/SecuritySchemeObject.java +++ b/src/gen/java/de/tudresden/inf/st/openapi/ast/SecuritySchemeObject.java @@ -36,7 +36,7 @@ public class SecuritySchemeObject extends ASTNode<ASTNode> implements Cloneable } /** * @aspect Parser - * @declaredat E:\\bachelor-thesis\\SigTest\\bachelor-thesis-jastadd\\src\\main\\jastadd\\Parser.jrag:687 + * @declaredat E:\\bachelor-thesis\\SigTest\\bachelor-thesis-jastadd\\src\\main\\jastadd\\Parser.jrag:751 */ public static SecuritySchemeObject parseSecurityScheme(SecurityScheme securityScheme){ SecuritySchemeObject securitySchemeObject = new SecuritySchemeObject(); diff --git a/src/gen/java/de/tudresden/inf/st/openapi/ast/TagObject.java b/src/gen/java/de/tudresden/inf/st/openapi/ast/TagObject.java index c65a67c46340223f729a9cf33c839544b9ec2eb1..eab434db339f82478fcf6986aaf0b55be3caf64d 100644 --- a/src/gen/java/de/tudresden/inf/st/openapi/ast/TagObject.java +++ b/src/gen/java/de/tudresden/inf/st/openapi/ast/TagObject.java @@ -31,7 +31,7 @@ public class TagObject extends ASTNode<ASTNode> implements Cloneable { } /** * @aspect Parser - * @declaredat E:\\bachelor-thesis\\SigTest\\bachelor-thesis-jastadd\\src\\main\\jastadd\\Parser.jrag:524 + * @declaredat E:\\bachelor-thesis\\SigTest\\bachelor-thesis-jastadd\\src\\main\\jastadd\\Parser.jrag:588 */ public static TagObject parseTag(org.openapi4j.parser.model.v3.Tag tag){ TagObject tagObject = new TagObject(); diff --git a/src/gen/java/de/tudresden/inf/st/openapi/ast/XmlObject.java b/src/gen/java/de/tudresden/inf/st/openapi/ast/XmlObject.java index c182ff43541845505e38c7f0c107414ad2d856f9..4aa1d8cfaf1eee0ca590e59de09d1537e684922a 100644 --- a/src/gen/java/de/tudresden/inf/st/openapi/ast/XmlObject.java +++ b/src/gen/java/de/tudresden/inf/st/openapi/ast/XmlObject.java @@ -35,7 +35,7 @@ public class XmlObject extends ASTNode<ASTNode> implements Cloneable { } /** * @aspect Parser - * @declaredat E:\\bachelor-thesis\\SigTest\\bachelor-thesis-jastadd\\src\\main\\jastadd\\Parser.jrag:670 + * @declaredat E:\\bachelor-thesis\\SigTest\\bachelor-thesis-jastadd\\src\\main\\jastadd\\Parser.jrag:734 */ public static XmlObject parseXml (Xml xml) { XmlObject xmlObject = new XmlObject(); diff --git a/src/main/jastadd/Composer.jadd b/src/main/jastadd/Composer.jadd index b0b9f23215c59ae1f9625bb165de17b9f862bc0a..295ebdd181e8f65ddda5a58764434afc43a67b8f 100644 --- a/src/main/jastadd/Composer.jadd +++ b/src/main/jastadd/Composer.jadd @@ -30,7 +30,7 @@ aspect Composer { if( openAPIObject.getNumSecurityRequirementObject() != 0 ){ List<SecurityRequirement> securityRequirements = new ArrayList<>(); for( SecurityRequirementObject s : openAPIObject.getSecurityRequirementObjects() ) - securityRequirements.add( SecurityRequirementObject.composeSecurityRequiremnet( s ) ); + securityRequirements.add( SecurityRequirementObject.composeSecurityRequirement( s ) ); api3.setSecurityRequirements(securityRequirements); } if( openAPIObject.getNumTagObject() != 0 ){ @@ -252,7 +252,7 @@ public static Operation OperationObject.composeOperation (OperationObject operat // operation.setDeprecated( (boolean) operationObject.getDeprecatedBoolean().getDeprecatedBoolean() ); if( operationObject.getNumSecurityRequirementObject() != 0 ){ for( SecurityRequirementObject s : operationObject.getSecurityRequirementObjects() ) - operation.addSecurityRequirement( SecurityRequirementObject.composeSecurityRequiremnet(s) ); + operation.addSecurityRequirement( SecurityRequirementObject.composeSecurityRequirement(s) ); } if( operationObject.getNumServerObject() != 0 ){ for( ServerObject s : operationObject.getServerObjects() ) diff --git a/src/test/java/openapi/OpenAPIMain_test.java b/src/test/java/openapi/OpenAPIMain_test.java index 18662146a9cb2d9b2aedd9903df64f8c36082efe..2e7b4a590b2487b45556ec4e184d06dbef5b0c42 100644 --- a/src/test/java/openapi/OpenAPIMain_test.java +++ b/src/test/java/openapi/OpenAPIMain_test.java @@ -20,6 +20,7 @@ import java.net.URL; import java.nio.file.Path; import java.nio.file.Paths; import java.util.ArrayList; +import java.util.List; import org.junit.jupiter.api.Test; import org.opentest4j.TestAbortedException; @@ -32,43 +33,51 @@ public class OpenAPIMain_test { public void test() throws IOException, ResolutionException, ValidationException, EncodeException { OpenAPIObject openApi; OpenApi3 api3; - ValidationResults results = new ValidationResults(); - String fileName = "uspto.json"; - FileWriter writer = new FileWriter("./gen-api-ex/" + fileName); - - URL expUrl = OpenAPIMain_test.class.getClassLoader().getResource(fileName); - File file = null; - if (expUrl != null) { - file = new File(expUrl.getFile()); - } else { - file = new File(fileName); - } - if (file == null) { - throw new FileNotFoundException("Could not load JSON file " + fileName); - } + ValidationResults results; + List<String> filenames = new ArrayList<>(); + + File resource = new File("./src/main/resources"); + + for( File file : resource.listFiles() ) + filenames.add(file.getName()); - // parsed openAPI object with openapi4j - OpenApi3 api = new OpenApi3Parser().parse(expUrl, new ArrayList<>(), true); - System.out.println("Loading expression DSL file '" + fileName + "'."); + for( String file : filenames ){ + URL expUrl = OpenAPIMain_test.class.getClassLoader().getResource(file); - // openAPI object is integrated in JastAdd grammar - openApi = OpenAPIObject.parseOpenAPI(api); + /* + File file = null; + if (expUrl != null) { + file = new File(expUrl.getFile()); + } else { + file = new File(fileName); + } + if (file == null) { + throw new FileNotFoundException("Could not load JSON file " + fileName); + }*/ - // composed openAPI object, it is expected to be equivalent to parsed source object - api3 = OpenAPIObject.composeOpenAPI(openApi); + // parsed openAPI object with openapi4j + OpenApi3 api = new OpenApi3Parser().parse(expUrl, new ArrayList<>(), true); + System.out.println("Loading expression DSL file '" + file + "'."); - // check, if the composed openAPI object is valid - results = OpenApi3Validator.instance().validate(api); - System.out.println("Is the source object valid? : " + results.isValid()); - results = OpenApi3Validator.instance().validate(api3); - System.out.println("Is the generated object valid? : " + results.isValid()); + // openAPI object is integrated in JastAdd grammar + openApi = OpenAPIObject.parseOpenAPI(api); - // compare if api (source object) is equivalent to api3 (generated object) - compareJson(api3.toNode(), api.toNode(), Paths.get(fileName)); + // composed openAPI object, it is expected to be equivalent to parsed source object + api3 = OpenAPIObject.composeOpenAPI(openApi); - // save the generated object - writer.write(api3.toNode().toPrettyString()); - writer.close(); + // check, if the composed openAPI object is valid + results = OpenApi3Validator.instance().validate(api); + System.out.println("Is the source object valid? : " + results.isValid()); + results = OpenApi3Validator.instance().validate(api3); + System.out.println("Is the generated object valid? : " + results.isValid()); + + // compare if api (source object) is equivalent to api3 (generated object) + compareJson(api3.toNode(), api.toNode(), Paths.get(file)); + + // save the generated object + //writer.write(api3.toNode().toPrettyString()); + //writer.close(); + } } protected void compareJson(JsonNode expectedNode, JsonNode actualNode, Path path) throws IOException {