This building block is a reference implementation of the OpenAPI specification for the ID Building block.
-
Pull down a copy of this git repo and install node via npm and install packages, e.g.
$ nvm install; yarn
. -
Start the server in dev mode with
$ yarn start:dev
. Useyarn test
to run tests. See package.json for other commands. -
To build a docker image, use
$ docker-compose build
. -
To release a new version, increment it in
package.json
anddocker-compose.yml
, then push the new version, e.g.$ docker push govstack/idbuildingblock:release-0.0.1
.
We are using Digital Ocean Apps to deploy docker images built locally and automatically via Docker Hub. To deploy a new version:
-
Visit the DO app
-
Select the Source tab
-
Change the tag and click the 'Save' button. Use the
latest
tag to deploy the latest version automatically built off of the main branch by docker hub.
-
Alerting is configured in the app settings.
-
Docker hub is configured for automated builds and vulnerability scanning
Time is of the essence, so I'll just use a generator and add a basic route manually for now...
$ npx express-generator-typescript --with-auth --socket-io --use-yarn "IDBuildingBlock"
I added the example API from swaggerhub to the generated server.
Ideally, we can generate the server completely from OpenAPI. I'd like to use express and typescript, lots of folks know it.
https://blog.simonireilly.com/posts/typescript-openapi gives a good overview of the current situation with typescript server generation. The author is working on a [https://github.com/simonireilly/compeller](library called compeller) that looks promising. Unfortunately, it can't import OpenAPI just yet.
Use openapi-generator, based on Java. There isn't any support for typescript server generation.
I changed the version in verification.json to 3.0.0 then was able to generate this:
$ openapi-generator generate --skip-validate-spec -g typescript-node -i ~/fabrik/BuildingBlockAPI/IDV/verification.json