Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,8 @@ localstack_data/
sandbox/specification/*
/volume/*
/coverage.xml
/lines-of-code-report*
/specification/postman
/sandbox/specification/*
/integration-test-results.xml
/specification/tmp/*
10 changes: 10 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,16 @@ config:: # Configure development environment (main) @Configuration
precommit: test-unit build test-integration lint ## Pre-commit tasks
python -m this

SPEC_DIR := $(CURDIR)/specification
POSTMAN_DIR := $(SPEC_DIR)/postman

convert-postman: # Create Postman collection from OAS spec
mkdir -p $(POSTMAN_DIR)
cp $(SPEC_DIR)/eligibility-signposting-api.yaml $(POSTMAN_DIR)/
docker build -t portman-converter -f $(POSTMAN_DIR)/Dockerfile $(SPEC_DIR)
docker run --rm -v $(SPEC_DIR):/app portman-converter \
portman -l /app/eligibility-signposting-api.yaml -o /app/postman/collection.json
rm $(POSTMAN_DIR)/eligibility-signposting-api.yaml
# ==============================================================================

${VERBOSE}.SILENT: \
Expand Down
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ The software will only be used for signposting an individual to an appropriate s
- [Testing](#testing)
- [Sandbox](#sandbox)
- [Conflict with yanai](#conflict-with-yanai)
- [Creating a Postman collection](#creating-a-postman-collection)
- [Design](#design)
- [Diagrams](#diagrams)
- [Modularity](#modularity)
Expand Down Expand Up @@ -103,6 +104,17 @@ If you have previously built [yanai](https://nhsd-confluence.digital.nhs.uk/page
docker rmi localstack/localstack
```

## Creating a Postman collection

A Postman collection can be generated from the Open API specification in `specification/` by running the following make command:

```shell
make convert-postman
```

The conversion is done using the [Portman CLI](https://github.com/apideck-libraries/portman). The resulting Postman collection
is saved to `specification/postman/`.

## Design

We'll be separating our [presentation](https://martinfowler.com/eaaDev/SeparatedPresentation.html) layer (where API logic lives, in [`views/`](src/eligibility_signposting_api/views)), [business services](https://martinfowler.com/eaaCatalog/serviceLayer.html) layer (where business logic lives, in [`services/`](src/eligibility_signposting_api/services)) and [repository](https://martinfowler.com/eaaCatalog/repository.html) layer (where database logic lives, [`repos/`](src/eligibility_signposting_api/repos)). We will be using [wireup](https://pypi.org/project/wireup/) for [dependency injection](https://pinboard.in/u:brunns/t:dependency-injection), so services get their dependencies given to them ("injection"), and wireup takes care of that. (We'll usually use the [`@service` annotation](https://maldoinc.github.io/wireup/latest/services/), but [factory functions](https://maldoinc.github.io/wireup/latest/factory_functions/) will be used where necessary, typically for creating resources from 3rd party libraries.) We'll be using [Pydantic](https://pypi.org/project/pydantic/) for both response models and database models.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,4 @@ colima
wireup
Pydantic
yanai
Portman
9 changes: 9 additions & 0 deletions specification/postman/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM node:18-alpine

RUN npm install -g @apideck/portman

WORKDIR /app

COPY ../eligibility-signposting-api.yaml .

CMD ["portman", "-l", "eligibility-signposting-api.yaml", "-o", "collection.json"]
Loading