Open kdaily opened 6 years ago
Candidate for Synapse in Practice article, primarily targeted at developers and internal power users.
Topics:
We commit to a v1 of this doc by June but reserve the right to punt more complex stuff until later.
Of note, @jaeddy possibly got our API to work with Swagger...
Thanks @kdaily - I'll add some notes here on the process and results.
conda
) and install [need to check for missing dependencies...]:
java-jdk
(Must be jdk 8)maven
conda create -n synrest
conda install -c bioconda java-jdk
conda install -c conda-forge maven
Under /services/repository/
...
pom.xml
file in the dependencies
section:<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>2.9.2</version>
<scope>compile</scope>
</dependency>
pom.xml
in the build/plugins
section:<plugin>
<groupId>com.webcohesion.enunciate</groupId>
<artifactId>enunciate-maven-plugin</artifactId>
<version>2.11.0</version>
<executions>
<execution>
<goals>
<goal>docs</goal>
</goals>
<configuration>
<configFile>enunciate.xml</configFile>
<docsDir>${project.build.directory}</docsDir>
</configuration>
</execution>
</executions>
</plugin>
enunciate.xml
in the services/repository/
directory:<enunciate xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://enunciate.webcohesion.com/schemas/enunciate-2.11.0.xsd">
<application root="/rest" />
<!-- use to build Swagger docs for specific APIs, e.g. 'Activities'-->
<!-- <api-classes>-->
<!-- <include pattern="org.sagebionetworks.repo.web.controller.ActivityController"/>-->
<!-- </api-classes>-->
</enunciate>
/services/repository/
directory, run:mvn compile
Navigate to /services/repository/target/apidocs/
. Under ./ui/
, open index.html
in browser:
The spec itself can be found at /services/repository/target/apidocs/ui/swagger.json
.
json_AccessApproval
appears at both line 270
and line 16401
. Because there are a lot of models in the Synapse API, this means a lot of extraneous lines of code in the spec.
From https://sagebionetworks.jira.com/browse/PLFM-4795.
Some use cases coming up (that need more documentation from me) where using the REST API would be useful instead of one of the clients.
See the Jira issue for some example REST API docs structures.