Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
423cd57
eli-225 adding back in poetry, updating make and readme
eddalmond1 Apr 30, 2025
9db71ad
eli-225 adding placeholders for all other files used in bundling spec
eddalmond1 Apr 30, 2025
ba26abc
eli-225 adding spelling 'mistakes' to allowed list
eddalmond1 Apr 30, 2025
e02578d
eli-225 updating make to ensure folder exists
eddalmond1 Apr 30, 2025
e78e361
eli-225 updating github action
eddalmond1 Apr 30, 2025
e824b25
eli-225 fixing github action
eddalmond1 Apr 30, 2025
8185610
eli-225 filling in template values, best guesses for now
eddalmond1 Apr 30, 2025
3d861a5
eli-225 removing packages from pyproject.toml
eddalmond1 May 1, 2025
b330aa5
eli-225 adding list of envs to readme instructions
eddalmond1 May 1, 2025
ab0ab42
eli-225 adding ability to omit securityScheme from sandbox specification
eddalmond1 May 1, 2025
7d1a941
eli-225 working on getting linting for specification working
eddalmond1 May 1, 2025
22f1e2d
eli-225 amending yq command as github actions uses the python version
eddalmond1 May 1, 2025
0018c0b
eli-225 changing yq command pt 2
eddalmond1 May 1, 2025
5961ca7
eli-225 updating sandbox + readme
eddalmond1 May 1, 2025
8a2eb6d
eli-225 amending readme
eddalmond1 May 1, 2025
befa248
eli-225 removing git ignore for postman collection, adding latest col…
eddalmond1 May 1, 2025
8b931ff
eli-225 updating spec with correct urls
eddalmond1 May 1, 2025
bc28e02
eli-225 sorting out file ending
eddalmond1 May 1, 2025
838ed4c
eli-225 fixing postman output - final line needs to be newline
eddalmond1 May 1, 2025
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
5 changes: 3 additions & 2 deletions .github/actions/lint-and-validate-specification/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,9 @@ runs:

- name: Lint OpenAPI Spec with Spectral
shell: bash
run: spectral lint --ruleset .spectral.yaml build/specification/eligibility-signposting-api.yaml
run: |
spectral lint --ruleset .spectral.yaml build/specification/${{ inputs.apim-env }}/eligibility-signposting-api.yaml

- name: Validate OpenAPI Spec with Swagger CLI
shell: bash
run: swagger-cli validate build/specification/eligibility-signposting-api.yaml
run: swagger-cli validate build/specification/${{ inputs.apim-env }}/eligibility-signposting-api.yaml
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ public/
sandbox/tests
sandbox/__pycache__
/specification/tmp/*
/specification/tmp/working/*
/sandbox/specification/*
sandbox/specification/*
/specification/postman
/coverage.xml
*/package-lock.json

Expand Down
2 changes: 2 additions & 0 deletions .tool-versions
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

pre-commit 3.6.0
vale 3.6.0
poetry 2.1.1

# ==============================================================================
# The section below is reserved for Docker image versions.
Expand All @@ -14,6 +15,7 @@ vale 3.6.0
# docker/ghcr.io/make-ops-tools/gocloc latest@sha256:6888e62e9ae693c4ebcfed9f1d86c70fd083868acb8815fe44b561b9a73b5032 # SEE: https://github.com/make-ops-tools/gocloc/pkgs/container/gocloc
# docker/ghcr.io/nhs-england-tools/github-runner-image 20230909-321fd1e-rt@sha256:ce4fd6035dc450a50d3cbafb4986d60e77cb49a71ab60a053bb1b9518139a646 # SEE: https://github.com/nhs-england-tools/github-runner-image/pkgs/container/github-runner-image
# docker/hadolint/hadolint 2.12.0-alpine@sha256:7dba9a9f1a0350f6d021fb2f6f88900998a4fb0aaf8e4330aa8c38544f04db42 # SEE: https://hub.docker.com/r/hadolint/hadolint/tags
# docker/hashicorp/terraform 1.5.6@sha256:180a7efa983386a27b43657ed610e9deed9e6c3848d54f9ea9b6cb8a5c8c25f5 # SEE: https://hub.docker.com/r/hashicorp/terraform/tags
# docker/jdkato/vale v3.6.0@sha256:0ef22c8d537f079633cfff69fc46f69a2196072f69cab1ab232e8a79a388e425 # SEE: https://hub.docker.com/r/jdkato/vale/tags
# docker/koalaman/shellcheck latest@sha256:e40388688bae0fcffdddb7e4dea49b900c18933b452add0930654b2dea3e7d5c # SEE: https://hub.docker.com/r/koalaman/shellcheck/tags
# docker/mstruebing/editorconfig-checker 2.7.1@sha256:dd3ca9ea50ef4518efe9be018d669ef9cf937f6bb5cfe2ef84ff2a620b5ddc24 # SEE: https://hub.docker.com/r/mstruebing/editorconfig-checker/tags
Expand Down
41 changes: 31 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,12 @@ MAKE_DIR := $(abspath $(shell pwd))

#Installs dependencies using poetry.
install-python:
poetry install
poetry install --no-root

#Installs dependencies using npm.
install-node:
npm install --legacy-peer-deps

#Configures Git Hooks, which are scripts that run given a specified event.
.git/hooks/pre-commit:
cp scripts/pre-commit .git/hooks/pre-commit

#Condensed Target to run all targets above.
install: install-node install-python .git/hooks/pre-commit

Expand All @@ -33,11 +29,12 @@ format: ## Format and fix code
poetry run ruff check . --fix-only

#Creates the fully expanded OAS spec in json
publish: clean
generate-sandbox-spec: clean
mkdir -p build
mkdir -p sandbox/specification
npm run publish 2> /dev/null
cp build/eligibility-signposting-api.json sandbox/specification/eligibility-signposting-api.json
cp build/specification/sandbox/eligibility-signposting-api.json sandbox/specification/eligibility-signposting-api.json

#Files to loop over in release
_dist_include="pytest.ini poetry.lock poetry.toml pyproject.toml Makefile build/. tests"

Expand Down Expand Up @@ -66,6 +63,26 @@ get-spec: # Get the most recent specification live in proxygen
$(MAKE) setup-proxygen-credentials
proxygen spec get

get-spec-uat: # Get the most recent specification live in proxygen
$(MAKE) setup-proxygen-credentials
proxygen spec get --uat

publish-spec: # Publish the specification to proxygen
$(MAKE) setup-proxygen-credentials
proxygen spec publish --specification-file build/prod/eligibility-signposting-api.yaml

publish-spec-uat: # Publish the specification to proxygen
$(MAKE) setup-proxygen-credentials
proxygen spec publish --specification-file build/preprod/eligibility-signposting-api.yaml --uat

delete-spec: # Delete the specification from proxygen
$(MAKE) setup-proxygen-credentials
proxygen spec delete

delete-spec-uat: # Delete the specification from proxygen
$(MAKE) setup-proxygen-credentials
proxygen spec delete --uat

# Specification

guard-%:
Expand Down Expand Up @@ -107,9 +124,12 @@ endif

construct-spec: guard-APIM_ENV
@ $(MAKE) update-spec-template APIM_ENV=$$APIM_ENV
mkdir -p build/specification && \
mkdir -p build/specification/$(APIM_ENV) && \
npx redocly bundle specification/eligibility-signposting-api.yaml --remove-unused-components --keep-url-references --ext yaml \
> build/specification/eligibility-signposting-api.yaml
> build/specification/$(APIM_ENV)/eligibility-signposting-api.yaml
ifeq ($(APIM_ENV),sandbox)
yq 'del(.components.securitySchemes)' build/specification/sandbox/eligibility-signposting-api.yaml > build/specification/sandbox/eligibility-signposting-api.yaml.tmp && mv build/specification/sandbox/eligibility-signposting-api.yaml.tmp build/specification/sandbox/eligibility-signposting-api.yaml
endif

SPEC_DIR := $(CURDIR)/specification
POSTMAN_DIR := $(SPEC_DIR)/postman
Expand All @@ -118,8 +138,9 @@ 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 \
docker run --rm -u $(shell id -u):$(shell id -g) -v $(SPEC_DIR):/app portman-converter \
portman -l /app/eligibility-signposting-api.yaml -o /app/postman/collection.json
echo >> $(POSTMAN_DIR)/collection.json
rm $(POSTMAN_DIR)/eligibility-signposting-api.yaml
# ==============================================================================

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "OAS (Swagger v3) API Definition for Template API",
"scripts": {
"lint": "node_modules/.bin/openapi-generator-cli validate -i specification/eligibility-signposting-api.yaml",
"publish": "./node_modules/.bin/openapi-generator-cli generate -i build/specification/eligibility-signposting-api.yaml --generator-key v3.0 -g openapi -o build && rm openapitools.json && mv build/openapi.json build/eligibility-signposting-api.json",
"publish": "./node_modules/.bin/openapi-generator-cli generate -i build/specification/sandbox/eligibility-signposting-api.yaml --generator-key v3.0 -g openapi -o build && rm openapitools.json && mv build/openapi.json build/specification/sandbox/eligibility-signposting-api.json",
"check-licenses": "node_modules/.bin/license-checker --failOn GPL --failOn LGPL"
},
"author": "NHS Digital",
Expand Down
Loading
Loading