Skip to content

Commit 98904cd

Browse files
NHSO-0000: Upgrade packages. (#314)
1 parent 4cafe55 commit 98904cd

16 files changed

Lines changed: 2787 additions & 6800 deletions

.github/workflows/continuous-integration.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
- name: Install node
2727
run: |
2828
wget -q -O - https://dl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
29-
curl -sL https://deb.nodesource.com/setup_20.x | sudo -E bash -
29+
curl -sL https://deb.nodesource.com/setup_24.x | sudo -E bash -
3030
sudo apt-get install -y nodejs
3131
3232
- name: Upgrade python packaging tools

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ check-licenses:
3434
format:
3535
poetry run black **/*.py
3636

37-
sandbox: update-examples
37+
sandbox:
3838
cd sandbox && npm run start
3939

4040
build-proxy:

azure/azure-build-pipeline.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,6 @@ variables:
2525
extends:
2626
template: azure/common/apigee-build.yml@common
2727
parameters:
28+
python_version: 3.10
2829
service_name: ${{ variables.service_name }}
2930
short_service_name: ${{ variables.short_service_name }}

package-lock.json

Lines changed: 2069 additions & 3713 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@
1212
"license": "MIT",
1313
"homepage": "https://github.com/NHSDigital/nhs-app",
1414
"dependencies": {
15-
"@redocly/cli": "^1.34.5"
15+
"@redocly/cli": "^2.11.1"
1616
}
1717
}

poetry.lock

Lines changed: 153 additions & 125 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[project]
2-
python = "^3.13"
2+
python = "^3.10"
33
name = "nhs-app"
44

55
[tool.poetry]
@@ -20,21 +20,25 @@ homepage = "https://digital.nhs.uk/developer/api-catalogue/nhs-app"
2020

2121
keywords = ["healthcare", "uk", "nhs"] #TODO add additional keywords
2222

23+
package-mode = false
2324

2425
[tool.poetry.dependencies]
25-
python = "^3.8"
26+
python = "^3.10"
2627
pyyaml = "^6.0"
2728
docopt = "^0.6.2"
2829
jsonpath-rw = "^1.4.0"
2930
semver = "^2.9.0"
3031
gitpython = "^3.1.41"
3132

32-
3333
[tool.poetry.dev-dependencies]
34-
flake8 = "^3.7.9"
34+
flake8 = "^7.3.0"
3535
black = "^24.3"
3636
pip-licenses = "^2.0.1"
3737
jinja2 = "^3.1.5"
3838

3939

4040
[tool.poetry.scripts]
41+
42+
[tool.poetry.group.dev.dependencies]
43+
flake8 = "^7.3.0"
44+

sandbox/api/openapi.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,14 @@ info:
88
license:
99
name: MIT
1010
version: 1.0.0
11-
servers:
12-
- url: http://petstore.swagger.io
1311
tags:
1412
- name: createPets
1513
- name: listPets
1614
- name: showPetById
1715
paths:
1816
/pets:
1917
get:
18+
x-router-controller: petsController
2019
tags:
2120
- pets
2221
summary: List all pets
@@ -53,6 +52,7 @@ paths:
5352
$ref: '#/components/schemas/Error'
5453
x-swagger-router-controller: Pets
5554
post:
55+
x-router-controller: petsController
5656
tags:
5757
- pets
5858
summary: Create a pet
@@ -69,6 +69,7 @@ paths:
6969
x-swagger-router-controller: Pets
7070
/pets/{petId}:
7171
get:
72+
x-router-controller: petsController
7273
tags:
7374
- pets
7475
summary: Info for a specific pet

sandbox/index.js

Lines changed: 28 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,36 @@
11
'use strict';
22

3-
var path = require('path');
4-
var http = require('http');
3+
const path = require('path');
4+
const http = require('http');
5+
const express = require('express');
6+
const oasTools = require('oas-tools');
7+
const fs = require('node:fs');
58

6-
var oas3Tools = require('oas3-tools');
7-
var serverPort = 9000;
9+
const serverPort = 9000;
810

9-
// swaggerRouter configuration
10-
var options = {
11-
controllers: path.join(__dirname, './controllers')
11+
const app = express();
12+
13+
const config = {
14+
oasFile: path.resolve(__dirname, 'api/openapi.yaml'),
15+
controllers: path.resolve(__dirname, './controllers'),
16+
loglevel: 'info',
17+
docs: true // Enable Swagger UI at /docs
1218
};
1319

14-
var expressAppConfig = oas3Tools.expressAppConfig(path.join(__dirname, 'api/openapi.yaml'), options);
15-
expressAppConfig.addValidator();
16-
var app = expressAppConfig.getApp();
20+
console.log("Using OpenAPI file:", config.oasFile);
21+
console.log("Exists?", fs.existsSync(config.oasFile));
22+
23+
try {
24+
// Initialize oas-tools (returns app wrapper)
25+
oasTools.initialize(app, config);
26+
27+
// Start server
28+
http.createServer(app).listen(serverPort, () => {
29+
console.log(`Server listening on http://localhost:${serverPort}`);
30+
console.log(`Swagger UI available at http://localhost:${serverPort}/docs`);
31+
});
1732

18-
// Initialize the Swagger middleware
19-
http.createServer(app).listen(serverPort, function () {
20-
console.log('Your server is listening on port %d (http://localhost:%d)', serverPort, serverPort);
21-
console.log('Swagger-ui is available on http://localhost:%d/docs', serverPort);
22-
});
33+
} catch (err) {
34+
console.error("Failed to initialize oas-tools:", err);
35+
}
2336

0 commit comments

Comments
 (0)