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
25 changes: 18 additions & 7 deletions .github/actions/lint-and-validate-specification/action.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name: "Lint and Validate OpenAPI v2 Spec"
description: "Lint and validate an OpenAPI v2 (Swagger) specification using Spectral and Swagger CLI"
inputs:
spec-file:
description: "Path to the OpenAPI v2 (Swagger) specification file"
apim-env:
description: "APIM environment for constructing the spec"
required: true

runs:
Expand All @@ -11,17 +11,28 @@ runs:
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
node-version: "20"

- name: Install Spectral and Swagger CLI
- name: Install dependencies
shell: bash
run: |
npm install -g @stoplight/spectral-cli swagger-cli
sudo apt-get update
sudo apt-get install -y make

- name: Install Spectral, Swagger CLI, and Redocly CLI
shell: bash
run: |
npm install -g @stoplight/spectral-cli swagger-cli @redocly/cli

- name: Construct OpenAPI Spec
shell: bash
run: |
make construct-spec APIM_ENV=${{ inputs.apim-env }}

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

- name: Validate OpenAPI Spec with Swagger CLI
shell: bash
run: swagger-cli validate ${{ inputs.spec-file }}
run: swagger-cli validate build/specification/eligibility-signposting-api.yaml
2 changes: 1 addition & 1 deletion .github/workflows/stage-1-commit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -118,4 +118,4 @@ jobs:
- uses: actions/checkout@v4
- uses: ./.github/actions/lint-and-validate-specification
with:
spec-file: specification/eligibility-signposting-api.yaml
apim-env: sandbox # or your desired environment
1 change: 1 addition & 0 deletions .spectral.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
extends: spectral:oas
3 changes: 0 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,6 @@ construct-spec: guard-APIM_ENV
mkdir -p build/specification && \
npx redocly bundle specification/eligibility-signposting-api.yaml --remove-unused-components --keep-url-references --ext yaml \
> build/specification/eligibility-signposting-api.yaml
ifeq ($(APIM_ENV), sandbox)
@ $(MAKE) publish
endif

SPEC_DIR := $(CURDIR)/specification
POSTMAN_DIR := $(SPEC_DIR)/postman
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ OAuth
Octokit
onboarding
Podman
Proxygen
Python
Redocly
sed
Syft
Terraform
Expand Down
2 changes: 1 addition & 1 deletion specification/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ To build a specification for a specific environment:
2. Run `make construct-spec` from the repository root, which:
- Updates templates with environment-specific values
- Uses Redocly to compile the complete specification to `build/specification/`
- For the `sandbox` environment, automatically runs `make publish` to convert the specification to JSON and save it to `sandbox/specification/` for immediate use
3. For the `sandbox` environment, run `make publish` to convert the specification to JSON and save it to `sandbox/specification/` for immediate use

### Deploying Environment-Specific Specifications

Expand Down
2 changes: 1 addition & 1 deletion specification/eligibility-signposting-api.yaml

Large diffs are not rendered by default.

Loading