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
2 changes: 1 addition & 1 deletion .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
- name: Install node
run: |
wget -q -O - https://dl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
curl -sL https://deb.nodesource.com/setup_20.x | sudo -E bash -
curl -sL https://deb.nodesource.com/setup_24.x | sudo -E bash -
sudo apt-get install -y nodejs

- name: Upgrade python packaging tools
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ check-licenses:
format:
poetry run black **/*.py

sandbox: update-examples
sandbox:
cd sandbox && npm run start

build-proxy:
Expand Down
1 change: 1 addition & 0 deletions azure/azure-build-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,6 @@ variables:
extends:
template: azure/common/apigee-build.yml@common
parameters:
python_version: 3.10
service_name: ${{ variables.service_name }}
short_service_name: ${{ variables.short_service_name }}
5,782 changes: 2,069 additions & 3,713 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@
"license": "MIT",
"homepage": "https://github.com/NHSDigital/nhs-app",
"dependencies": {
"@redocly/cli": "^1.34.5"
"@redocly/cli": "^2.11.1"
}
}
278 changes: 153 additions & 125 deletions poetry.lock

Large diffs are not rendered by default.

12 changes: 8 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[project]
python = "^3.13"
python = "^3.10"
name = "nhs-app"

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

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

package-mode = false

[tool.poetry.dependencies]
python = "^3.8"
python = "^3.10"
pyyaml = "^6.0"
docopt = "^0.6.2"
jsonpath-rw = "^1.4.0"
semver = "^2.9.0"
gitpython = "^3.1.41"


[tool.poetry.dev-dependencies]
flake8 = "^3.7.9"
flake8 = "^7.3.0"
black = "^24.3"
pip-licenses = "^2.0.1"
jinja2 = "^3.1.5"


[tool.poetry.scripts]

[tool.poetry.group.dev.dependencies]
flake8 = "^7.3.0"

5 changes: 3 additions & 2 deletions sandbox/api/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,14 @@ info:
license:
name: MIT
version: 1.0.0
servers:
- url: http://petstore.swagger.io
tags:
- name: createPets
- name: listPets
- name: showPetById
paths:
/pets:
get:
x-router-controller: petsController
tags:
- pets
summary: List all pets
Expand Down Expand Up @@ -53,6 +52,7 @@ paths:
$ref: '#/components/schemas/Error'
x-swagger-router-controller: Pets
post:
x-router-controller: petsController
tags:
- pets
summary: Create a pet
Expand All @@ -69,6 +69,7 @@ paths:
x-swagger-router-controller: Pets
/pets/{petId}:
get:
x-router-controller: petsController
tags:
- pets
summary: Info for a specific pet
Expand Down
43 changes: 28 additions & 15 deletions sandbox/index.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,36 @@
'use strict';

var path = require('path');
var http = require('http');
const path = require('path');
const http = require('http');
const express = require('express');
const oasTools = require('oas-tools');
const fs = require('node:fs');

var oas3Tools = require('oas3-tools');
var serverPort = 9000;
const serverPort = 9000;

// swaggerRouter configuration
var options = {
controllers: path.join(__dirname, './controllers')
const app = express();

const config = {
oasFile: path.resolve(__dirname, 'api/openapi.yaml'),
controllers: path.resolve(__dirname, './controllers'),
loglevel: 'info',
docs: true // Enable Swagger UI at /docs
};

var expressAppConfig = oas3Tools.expressAppConfig(path.join(__dirname, 'api/openapi.yaml'), options);
expressAppConfig.addValidator();
var app = expressAppConfig.getApp();
console.log("Using OpenAPI file:", config.oasFile);
console.log("Exists?", fs.existsSync(config.oasFile));

try {
// Initialize oas-tools (returns app wrapper)
oasTools.initialize(app, config);

// Start server
http.createServer(app).listen(serverPort, () => {
console.log(`Server listening on http://localhost:${serverPort}`);
console.log(`Swagger UI available at http://localhost:${serverPort}/docs`);
});

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

Loading