/identity-service-api

API Spec & Proxy for the NHS Identity IdP for NHS Digital's API Platform

Primary LanguagePythonOtherNOASSERTION

identity-service-api

Build

This is a RESTful HL7® FHIR® API specification for the Identity Service API.

  • specification/ This Open API Specification describes the endpoints, methods and messages exchanged by the API. Use it to generate interactive documentation; the contract between the API and its consumers.
  • scripts/ Utilities helpful to developers of this specification.
  • proxies/ The Apigee API Proxy

Consumers of the API will find developer documentation on the NHS Digital Developer Hub.

Contributing

Contributions to this project are welcome from anyone, providing that they conform to the guidelines for contribution and the community code of conduct.

Licensing

This code is dual licensed under the MIT license and the OGL (Open Government License). Any new work added to this repository must conform to the conditions of these licenses. In particular this means that this project may not depend on GPL-licensed or AGPL-licensed libraries, as these would violate the terms of those libraries' licenses.

The contents of this repository are protected by Crown Copyright (C).

Development

Requirements

  • make
  • nodejs + npm/yarn
  • poetry

Install

To setup

$ make install

Environment Variables

Various scripts and commands rely on environment variables being set. These are documented with the commands.

💡 Consider using direnv to manage your environment variables during development and maintaining your own .envrc file - the values of these variables will be specific to you and/or sensitive.

Make commands

There are make commands that alias some of this functionality:

  • lint -- Lints the spec and code
  • publish -- Outputs the specification as a single file into the build/ directory
  • serve -- Serves a preview of the specification in human-readable format

Running tests

For detailed instructions see /e2e.

VS Code Plugins

Emacs Plugins

Speccy

Speccy A handy toolkit for OpenAPI, with a linter to enforce quality rules, documentation rendering, and resolution.

Speccy does the lifting for the following npm scripts:

  • test -- Lints the definition
  • publish -- Outputs the specification as a single file into the build/ directory
  • serve -- Serves a preview of the specification in human-readable format

(Workflow detailed in a post on the developerjack blog.)

💡 The publish command is useful when uploading to Apigee which requires the spec as a single file.

Caveats

Swagger UI

Swagger UI unfortunately doesn't correctly render $refs in examples, so use speccy serve instead.

Platform setup

Successful deployment of the API Proxy requires:

  1. A Key-Value Map named identity_service_variables
  2. An encrypted Key-Value Map named identity-service-variables-encrypted

The Key-Value maps need to be specified within the api-management-infrastructure repository to be able to be used with the API proxy. :bulb: For Sandbox-running environments (test) these need to be present for successful deployment but can be set to empty/dummy values.