Skip to content

Commit ab0ab42

Browse files
committed
eli-225 adding ability to omit securityScheme from sandbox specification
1 parent b330aa5 commit ab0ab42

File tree

6 files changed

+118
-27
lines changed

6 files changed

+118
-27
lines changed

Makefile

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,12 @@ format: ## Format and fix code
2929
poetry run ruff check . --fix-only
3030

3131
#Creates the fully expanded OAS spec in json
32-
publish: clean
32+
generate-sandbox-spec: clean
3333
mkdir -p build
3434
mkdir -p sandbox/specification
3535
npm run publish 2> /dev/null
36-
cp build/sandbox/eligibility-signposting-api.json sandbox/specification/eligibility-signposting-api.json
36+
cp build/specification/sandbox/eligibility-signposting-api.json sandbox/specification/eligibility-signposting-api.json
37+
3738
#Files to loop over in release
3839
_dist_include="pytest.ini poetry.lock poetry.toml pyproject.toml Makefile build/. tests"
3940

@@ -68,11 +69,11 @@ get-spec-uat: # Get the most recent specification live in proxygen
6869

6970
publish-spec: # Publish the specification to proxygen
7071
$(MAKE) setup-proxygen-credentials
71-
proxygen spec publish --specification-file build/prod/eligibility-signposting-api.json
72+
proxygen spec publish --specification-file build/prod/eligibility-signposting-api.yaml
7273

7374
publish-spec-uat: # Publish the specification to proxygen
7475
$(MAKE) setup-proxygen-credentials
75-
proxygen spec publish --specification-file build/preprod/eligibility-signposting-api.json --uat
76+
proxygen spec publish --specification-file build/preprod/eligibility-signposting-api.yaml --uat
7677

7778
delete-spec: # Delete the specification from proxygen
7879
$(MAKE) setup-proxygen-credentials
@@ -126,6 +127,9 @@ construct-spec: guard-APIM_ENV
126127
mkdir -p build/specification/$(APIM_ENV) && \
127128
npx redocly bundle specification/eligibility-signposting-api.yaml --remove-unused-components --keep-url-references --ext yaml \
128129
> build/specification/$(APIM_ENV)/eligibility-signposting-api.yaml
130+
ifeq ($(APIM_ENV),sandbox)
131+
yq -y 'del(.components.securitySchemes) | select(.components.securitySchemes == {} or .components.securitySchemes == null)' -i build/specification/sandbox/eligibility-signposting-api.yaml
132+
endif
129133

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

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"description": "OAS (Swagger v3) API Definition for Template API",
55
"scripts": {
66
"lint": "node_modules/.bin/openapi-generator-cli validate -i specification/eligibility-signposting-api.yaml",
7-
"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",
7+
"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",
88
"check-licenses": "node_modules/.bin/license-checker --failOn GPL --failOn LGPL"
99
},
1010
"author": "NHS Digital",

poetry.lock

Lines changed: 61 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ python = "^3.13"
2323
ruff = "^0.11.0"
2424
awscli = "^1.37.24"
2525
awscli-local = "^0.22.0"
26+
yq = "^3.2.3" # Development-only dependency for YAML processing; version chosen for compatibility with project tooling
2627

2728
[tool.ruff]
2829
line-length = 120

sandbox/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ update:
2525

2626
spec:
2727
mkdir -p specification
28-
make -C .. publish
28+
make -C .. generate-sandbox-spec
2929

3030
test:
3131
UPSTREAM_HOST=test poetry run pytest

sandbox/specification/eligibility-signposting-api.json

Lines changed: 46 additions & 20 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)