Skip to content

Latest commit

 

History

History
100 lines (67 loc) · 2.62 KB

DEVELOPER.md

File metadata and controls

100 lines (67 loc) · 2.62 KB

Overview

Designed to host API documentation for REST services. See spec/apibuilder-api.json for description of the API. Code generators for various languages & frameworks are independent of this application. Official generators can be found in apibuilder-generators.

Projects

There are several projects within the apibuilder repo.

core

Contains shared code to parse an api.json file into case classes, including validation on the document in a way that is friendly to users.

api

apibuilder REST service itself. See spec/apibuilder-api.json contains the description of the API.

app

Actual UI for apibuilder.

Generated Code

The .apibuilder file lists the specific targets which are generated by apibuilder. To regenerate code, clone github.com/apicollective/apibuilder-cli and

bin/apibuilder update

In development:

APIBUILDER_API_URI="http://localhost:9001" /web/apibuilder-cli/bin/apibuilder update

Updating apibuilder.me

script/update
script/update_daos

SBT

Memory settings for SBT:

exec java -Xms512M -Xmx2048M -XX:MaxPermSize=1G -Xss1M -XX:+CMSClassUnloadingEnabled \ 
  ${SBT_OPTS} -jar /usr/local/Cellar/sbt/0.13.5/libexec/sbt-launch.jar "$@"

Developing

You'll need to run the postgresql database (version 9.5 or greater). Two options:

  1. docker run -d -p 5432:5432 flowcommerce/apibuilder-postgresql:latest

  2. run locally - see the project https://github.com/apicollective/apibuilder-postgresql

    • You need to run psql -U api apibuilderdb ./setup-test-data.sql to get the dev user

The application consists of a service on port 9001, and a web app on port 9000.

One way to do this is to run a screen session, and in one screen do:

$ sbt
sbt> project api
sbt> run 9001

...then in another screen, do:

$ sbt
sbt> project app
sbt> run

Goto http://localhost:9000/login/dev in your browser to login automatically as the dev user.

If you want to run the standard code generators service locally you can clone it from apibuilder-generator

$ sbt
sbt> project generator
sbt> run 9002

To configure generators in local api builder instance:

  1. Goto http://localhost:9000/generators
  2. Click 'Add generator'
  3. Enter 'http://localhost:9002' for service URI

Now both should be running and able to talk to each other, and should recompile in site for a nice development experience.

Updating generated code

/web/apibuilder-cli/bin/apibuilder update