From de92e8ebbe6ddc365c9dba4e753c4fc7c6886f6b Mon Sep 17 00:00:00 2001 From: github-actions <62281988+JackPlowman@users.noreply.github.com> Date: Thu, 29 May 2025 14:17:01 +0100 Subject: [PATCH 1/3] NPA-5054 Run Prettier --- .github/ISSUE_TEMPLATE/bug_report.md | 14 +- .github/pull_request_template.md | 6 +- .prettierignore | 2 + .vscode/extensions.json | 5 +- CODE_OF_CONDUCT.md | 26 +- CONTRIBUTING.md | 26 +- DEVELOPMENT_GUIDE.md | 76 +-- README.md | 20 +- SECURITY.md | 4 +- ...ip Service Sandbox.postman_collection.json | 458 +++++------------- .../resources/jsc/HealthCheck.SetResponse.js | 63 +-- .../resources/jsc/HealthCheck.SetResponse.js | 63 +-- sandbox/README.md | 28 +- 13 files changed, 286 insertions(+), 505 deletions(-) create mode 100644 .prettierignore diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 1237b258..e87cdcb6 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -25,16 +25,16 @@ If applicable, add screenshots to help explain your problem. **Desktop (please complete the following information):** -- OS: [e.g. iOS] -- Browser: [e.g. chrome, safari] -- Version: [e.g. 22] +- OS: [e.g. iOS] +- Browser: [e.g. chrome, safari] +- Version: [e.g. 22] **Smartphone (please complete the following information):** -- Device: [e.g. iPhone6] -- OS: [e.g. iOS8.1] -- Browser: [e.g. stock browser, safari] -- Version: [e.g. 22] +- Device: [e.g. iPhone6] +- OS: [e.g. iOS8.1] +- Browser: [e.g. stock browser, safari] +- Version: [e.g. 22] **Additional context** Add any other context about the problem here. diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index dcab34a9..a9a79110 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -42,9 +42,9 @@ Stages to complete before opening the Pull Request: :information_source: This section is to be filled in by the **reviewer**. -- [ ] I have reviewed the changes in this PR and they fill all or part of the acceptance criteria of the ticket, and the code is in a mergeable state. -- [ ] If there were infrastructure, operational, or build changes, I have made sure there is sufficient evidence that the changes will work. -- [ ] I have ensured the changelog has been updated by the submitter, if necessary. +- [ ] I have reviewed the changes in this PR and they fill all or part of the acceptance criteria of the ticket, and the code is in a mergeable state. +- [ ] If there were infrastructure, operational, or build changes, I have made sure there is sufficient evidence that the changes will work. +- [ ] I have ensured the changelog has been updated by the submitter, if necessary. ## Post-merge diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 00000000..99e60738 --- /dev/null +++ b/.prettierignore @@ -0,0 +1,2 @@ +*.yaml +*.yml diff --git a/.vscode/extensions.json b/.vscode/extensions.json index b28b8a14..38ed8ebf 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -1,6 +1,3 @@ { - "recommendations": [ - "mermade.openapi-lint", - "42Crunch.vscode-openapi" - ] + "recommendations": ["mermade.openapi-lint", "42Crunch.vscode-openapi"] } diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index 07e36463..6be90ed5 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -14,22 +14,22 @@ appearance, race, religion, or sexual identity and orientation. Examples of behaviour that contributes to creating a positive environment include: -- Using welcoming and inclusive language -- Being respectful of differing viewpoints and experiences -- Gracefully accepting constructive criticism -- Focusing on what is best for the community -- Showing empathy towards other community members +- Using welcoming and inclusive language +- Being respectful of differing viewpoints and experiences +- Gracefully accepting constructive criticism +- Focusing on what is best for the community +- Showing empathy towards other community members Examples of unacceptable behaviour by participants include: -- The use of sexualized language or imagery and unwelcome sexual attention or - advances -- Trolling, insulting/derogatory comments, and personal or political attacks -- Public or private harassment -- Publishing others' private information, such as a physical or electronic - address, without explicit permission -- Other conduct which could reasonably be considered inappropriate in a - professional setting +- The use of sexualized language or imagery and unwelcome sexual attention or + advances +- Trolling, insulting/derogatory comments, and personal or political attacks +- Public or private harassment +- Publishing others' private information, such as a physical or electronic + address, without explicit permission +- Other conduct which could reasonably be considered inappropriate in a + professional setting ## Our Responsibilities diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 192c323e..93f0f2dc 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -3,16 +3,16 @@ > [!WARNING] > Some of the documentation and links in this file are specific to the maintainers of this repository and are only available to NHS England staff. -- [Contribution Guidelines](#contribution-guidelines) - - [Raising an Issue](#raising-an-issue) - - [Contributing code](#contributing-code) - - [Merge responsibility](#merge-responsibility) - - [Branch naming](#branch-naming) - - [Developers within the NHS](#developers-within-the-nhs) - - [Developers outside of the NHS](#developers-outside-of-the-nhs) - - [Commit messages](#commit-messages) - - [Developers within the NHS](#developers-within-the-nhs-1) - - [Developers outside of the NHS](#developers-outside-of-the-nhs-1) +- [Contribution Guidelines](#contribution-guidelines) + - [Raising an Issue](#raising-an-issue) + - [Contributing code](#contributing-code) + - [Merge responsibility](#merge-responsibility) + - [Branch naming](#branch-naming) + - [Developers within the NHS](#developers-within-the-nhs) + - [Developers outside of the NHS](#developers-outside-of-the-nhs) + - [Commit messages](#commit-messages) + - [Developers within the NHS](#developers-within-the-nhs-1) + - [Developers outside of the NHS](#developers-outside-of-the-nhs-1) ## Raising an Issue @@ -29,9 +29,9 @@ so please explain why the changes need to be made (unless it is self-evident). ### Merge responsibility -- It is the responsibility of the reviewer to merge branches they have approved. -- It is the responsibility of the author of the merge to ensure their merge is in a mergeable state. -- It is the responsibility of the maintainers to ensure the merge process is unambiguous and automated where possible. +- It is the responsibility of the reviewer to merge branches they have approved. +- It is the responsibility of the author of the merge to ensure their merge is in a mergeable state. +- It is the responsibility of the maintainers to ensure the merge process is unambiguous and automated where possible. ### Branch naming diff --git a/DEVELOPMENT_GUIDE.md b/DEVELOPMENT_GUIDE.md index 21713fea..b5fd2cc7 100644 --- a/DEVELOPMENT_GUIDE.md +++ b/DEVELOPMENT_GUIDE.md @@ -7,27 +7,27 @@ This documentation is intended for developers to develop the schema, sandbox and ## Table of Contents -- [Development Guide](#development-guide) - - [Table of Contents](#table-of-contents) - - [Development](#development) - - [Requirements](#requirements) - - [Make commands](#make-commands) - - [Testing](#testing) - - [Platform setup](#platform-setup) - - [Detailed folder walk through](#detailed-folder-walk-through) - - [`/.github`:](#github) - - [`/azure`:](#azure) - - [`/proxies`:](#proxies) - - [`/scripts`:](#scripts) - - [`/specification`:](#specification) - - [`/tests`:](#tests) - - [`Makefile`:](#makefile) - - [`ecs-proxies-containers.yml ` and `ecs-proxies-deploy.yml`:](#ecs-proxies-containersyml--and-ecs-proxies-deployyml) - - [`manifest_template.yml`:](#manifest_templateyml) - - [Releasing a new schema version](#releasing-a-new-schema-version) - - [Caveats](#caveats) - - [Swagger UI](#swagger-ui) - - [Apigee Portal](#apigee-portal) +- [Development Guide](#development-guide) + - [Table of Contents](#table-of-contents) + - [Development](#development) + - [Requirements](#requirements) + - [Make commands](#make-commands) + - [Testing](#testing) + - [Platform setup](#platform-setup) + - [Detailed folder walk through](#detailed-folder-walk-through) + - [`/.github`:](#github) + - [`/azure`:](#azure) + - [`/proxies`:](#proxies) + - [`/scripts`:](#scripts) + - [`/specification`:](#specification) + - [`/tests`:](#tests) + - [`Makefile`:](#makefile) + - [`ecs-proxies-containers.yml ` and `ecs-proxies-deploy.yml`:](#ecs-proxies-containersyml--and-ecs-proxies-deployyml) + - [`manifest_template.yml`:](#manifest_templateyml) + - [Releasing a new schema version](#releasing-a-new-schema-version) + - [Caveats](#caveats) + - [Swagger UI](#swagger-ui) + - [Apigee Portal](#apigee-portal) ## Development @@ -36,12 +36,12 @@ This documentation is intended for developers to develop the schema, sandbox and ### Requirements -- GNU make -- nodejs 22+ - - npm 10.8+ -- Python 3.8 + - - [poetry](https://github.com/python-poetry/poetry) 1.8+ -- Java 8+ +- GNU make +- nodejs 22+ + - npm 10.8+ +- Python 3.8 + + - [poetry](https://github.com/python-poetry/poetry) 1.8+ +- Java 8+ ### Make commands @@ -49,9 +49,9 @@ To run the below make targets you will first need to run `make install-node` There are `make` commands that alias scripts in the `package.json` -- `lint` -- Lints the spec and code -- `publish` -- Outputs the specification as a **single file** into the `build/` directory -- `serve` -- Serves a preview of the specification in human-readable format +- `lint` -- Lints the spec and code +- `publish` -- Outputs the specification as a **single file** into the `build/` directory +- `serve` -- Serves a preview of the specification in human-readable format ### Testing @@ -77,19 +77,19 @@ For further information about Apigee and APIM see [API Producer Zone confluence] `/.github/workflows`: This folder contains GitHub workflows, these workflow are mainly used to check pull requests and publish releases. -- `pr-lint.yaml`: This workflow links Pull Request's to Jira tickets and runs when a pull request is opened/updated. -- `continuous-integration.yml`: This workflow publishes a Github release when pushing to master. -- `sandbox-checks.yaml`: This workflow checks the sandbox meets the formatting and linting rules (Black + Flake8). Also it runs the sandbox unit tests (Pytest) -- `dependency-review.yml`: This workflow checks for any vulnerabilities in dependencies to be added to the project. -- `codeql-analysis.yml`: This workflow checks for any code vulnerabilities in the project. +- `pr-lint.yaml`: This workflow links Pull Request's to Jira tickets and runs when a pull request is opened/updated. +- `continuous-integration.yml`: This workflow publishes a Github release when pushing to master. +- `sandbox-checks.yaml`: This workflow checks the sandbox meets the formatting and linting rules (Black + Flake8). Also it runs the sandbox unit tests (Pytest) +- `dependency-review.yml`: This workflow checks for any vulnerabilities in dependencies to be added to the project. +- `codeql-analysis.yml`: This workflow checks for any code vulnerabilities in the project. #### `/azure`: Contains Azure Devops pipelines for building and deploying to Apigee: -- `azure-build-pipeline.yml`: Assembles the contents of your repository into a single file ("artifact") on Azure Devops and pushes any containers to our Docker registry. This pipeline is enabled for all branches. -- `azure-pr-pipeline.yml`: Deploys ephemeral versions of your proxy/spec to Apigee (and docker containers on AWS) to internal environments. This will deploy a internal-dev environment and internal-dev-sandbox for each pull request. -- `azure-release-pipeline.yml`: Deploys the long-lived version of your pipeline to internal and external environments, when you merge to master. +- `azure-build-pipeline.yml`: Assembles the contents of your repository into a single file ("artifact") on Azure Devops and pushes any containers to our Docker registry. This pipeline is enabled for all branches. +- `azure-pr-pipeline.yml`: Deploys ephemeral versions of your proxy/spec to Apigee (and docker containers on AWS) to internal environments. This will deploy a internal-dev environment and internal-dev-sandbox for each pull request. +- `azure-release-pipeline.yml`: Deploys the long-lived version of your pipeline to internal and external environments, when you merge to master. `/azure/templates`: Here you can define reusable actions, such as running tests, and call these actions during Azure Devops pipelines. diff --git a/README.md b/README.md index 23078757..36064a71 100644 --- a/README.md +++ b/README.md @@ -8,21 +8,21 @@ This repository does _not_ include the Validated Relationship Service FHIR API b ## Table of Contents -- [Validated Relationship Service API](#validated-relationship-service-api) - - [Table of Contents](#table-of-contents) - - [Repository Structure](#repository-structure) - - [Contributing](#contributing) - - [Development \& Testing](#development--testing) - - [Licensing](#licensing) +- [Validated Relationship Service API](#validated-relationship-service-api) + - [Table of Contents](#table-of-contents) + - [Repository Structure](#repository-structure) + - [Contributing](#contributing) + - [Development \& Testing](#development--testing) + - [Licensing](#licensing) ## Repository Structure This repository includes: -- [specification/validated-relationships-service-api.yaml](./specification/validated-relationships-service-api.yaml) - The [Open API Specification](https://swagger.io/docs/specification/about/) describes the endpoints, methods and messages exchanged by the API. Used to generate interactive documentation for the NHS API Catalogue; the contract between the API and its consumers. -- `sandbox/` - A flask (Python) API that implements a mock implementation of the service. It's to be used as interactive documentation to illustrate interactions and concepts. It is not intended to provide an exhaustive/faithful environment suitable for full development and testing. -- `scripts/` - Utilities helpful to developers for the development and release of the specification. -- `proxies/` - Live and sandbox Apigee API Proxy definitions. +- [specification/validated-relationships-service-api.yaml](./specification/validated-relationships-service-api.yaml) - The [Open API Specification](https://swagger.io/docs/specification/about/) describes the endpoints, methods and messages exchanged by the API. Used to generate interactive documentation for the NHS API Catalogue; the contract between the API and its consumers. +- `sandbox/` - A flask (Python) API that implements a mock implementation of the service. It's to be used as interactive documentation to illustrate interactions and concepts. It is not intended to provide an exhaustive/faithful environment suitable for full development and testing. +- `scripts/` - Utilities helpful to developers for the development and release of the specification. +- `proxies/` - Live and sandbox Apigee API Proxy definitions. ## Contributing diff --git a/SECURITY.md b/SECURITY.md index 2d5561a4..7de9d497 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -19,8 +19,8 @@ reproduce it. You can reach us at: -- cybersecurity@nhs.net -- api.management@nhs.net +- cybersecurity@nhs.net +- api.management@nhs.net ### HackerOne diff --git a/postman/Validate Relationship Service Sandbox.postman_collection.json b/postman/Validate Relationship Service Sandbox.postman_collection.json index cf5cab56..28e35e1b 100644 --- a/postman/Validate Relationship Service Sandbox.postman_collection.json +++ b/postman/Validate Relationship Service Sandbox.postman_collection.json @@ -16,9 +16,7 @@ { "listen": "test", "script": { - "exec": [ - "" - ], + "exec": [""], "type": "text/javascript" } } @@ -53,12 +51,8 @@ }, "url": { "raw": "{{api_base_url}}/QuestionnaireResponse", - "host": [ - "{{api_base_url}}" - ], - "path": [ - "QuestionnaireResponse" - ] + "host": ["{{api_base_url}}"], + "path": ["QuestionnaireResponse"] }, "description": "Example of an adult to child access request with the reference code returned" }, @@ -70,9 +64,7 @@ { "listen": "test", "script": { - "exec": [ - "" - ], + "exec": [""], "type": "text/javascript" } } @@ -106,12 +98,8 @@ }, "url": { "raw": "{{api_base_url}}/QuestionnaireResponse", - "host": [ - "{{api_base_url}}" - ], - "path": [ - "QuestionnaireResponse" - ] + "host": ["{{api_base_url}}"], + "path": ["QuestionnaireResponse"] }, "description": "Example of an adult to adult access request where the patient can consent with the reference code returned" }, @@ -123,9 +111,7 @@ { "listen": "test", "script": { - "exec": [ - "" - ], + "exec": [""], "type": "text/javascript" } } @@ -159,12 +145,8 @@ }, "url": { "raw": "{{api_base_url}}/QuestionnaireResponse", - "host": [ - "{{api_base_url}}" - ], - "path": [ - "QuestionnaireResponse" - ] + "host": ["{{api_base_url}}"], + "path": ["QuestionnaireResponse"] }, "description": "Example of an adult to adult access request where the patient cannot consent with the reference code returned" }, @@ -176,9 +158,7 @@ { "listen": "test", "script": { - "exec": [ - "" - ], + "exec": [""], "type": "text/javascript" } } @@ -212,12 +192,8 @@ }, "url": { "raw": "{{api_base_url}}/QuestionnaireResponse", - "host": [ - "{{api_base_url}}" - ], - "path": [ - "QuestionnaireResponse" - ] + "host": ["{{api_base_url}}"], + "path": ["QuestionnaireResponse"] }, "description": "Example of an adult to adult access request where the patient is the applicant with the reference code returned" }, @@ -229,9 +205,7 @@ "listen": "prerequest", "script": { "type": "text/javascript", - "exec": [ - "" - ] + "exec": [""] } }, { @@ -393,12 +367,8 @@ ], "url": { "raw": "{{api_base_url}}/RelatedPerson?identifier=9000000017", - "host": [ - "{{api_base_url}}" - ], - "path": [ - "RelatedPerson" - ], + "host": ["{{api_base_url}}"], + "path": ["RelatedPerson"], "query": [ { "key": "identifier", @@ -596,12 +566,8 @@ ], "url": { "raw": "{{api_base_url}}/RelatedPerson?identifier=9000000017&_include=RelatedPerson:patient", - "host": [ - "{{api_base_url}}" - ], - "path": [ - "RelatedPerson" - ], + "host": ["{{api_base_url}}"], + "path": ["RelatedPerson"], "query": [ { "key": "identifier", @@ -666,12 +632,8 @@ ], "url": { "raw": "{{api_base_url}}/RelatedPerson?identifier=9000000033", - "host": [ - "{{api_base_url}}" - ], - "path": [ - "RelatedPerson" - ], + "host": ["{{api_base_url}}"], + "path": ["RelatedPerson"], "query": [ { "key": "identifier", @@ -769,12 +731,8 @@ ], "url": { "raw": "{{api_base_url}}/RelatedPerson?identifier=9000000017&patient:identifier=9000000009", - "host": [ - "{{api_base_url}}" - ], - "path": [ - "RelatedPerson" - ], + "host": ["{{api_base_url}}"], + "path": ["RelatedPerson"], "query": [ { "key": "identifier", @@ -909,12 +867,8 @@ ], "url": { "raw": "{{api_base_url}}/RelatedPerson?identifier=9000000017&patient:identifier=9000000009&_include=RelatedPerson:patient", - "host": [ - "{{api_base_url}}" - ], - "path": [ - "RelatedPerson" - ], + "host": ["{{api_base_url}}"], + "path": ["RelatedPerson"], "query": [ { "key": "identifier", @@ -997,12 +951,8 @@ ], "url": { "raw": "{{api_base_url}}/RelatedPerson", - "host": [ - "{{api_base_url}}" - ], - "path": [ - "RelatedPerson" - ] + "host": ["{{api_base_url}}"], + "path": ["RelatedPerson"] }, "description": "Example of an error response when the NHS number is missing" }, @@ -1072,12 +1022,8 @@ ], "url": { "raw": "{{api_base_url}}/RelatedPerson?identifier=900000000", - "host": [ - "{{api_base_url}}" - ], - "path": [ - "RelatedPerson" - ], + "host": ["{{api_base_url}}"], + "path": ["RelatedPerson"], "query": [ { "key": "identifier", @@ -1151,12 +1097,8 @@ ], "url": { "raw": "{{api_base_url}}/RelatedPerson?identifier=https://fhir.nhs.uk/Id/nhs-number|A730675929", - "host": [ - "{{api_base_url}}" - ], - "path": [ - "RelatedPerson" - ], + "host": ["{{api_base_url}}"], + "path": ["RelatedPerson"], "query": [ { "key": "identifier", @@ -1229,12 +1171,8 @@ ], "url": { "raw": "{{api_base_url}}/RelatedPerson?identifier=1000000001", - "host": [ - "{{api_base_url}}" - ], - "path": [ - "RelatedPerson" - ], + "host": ["{{api_base_url}}"], + "path": ["RelatedPerson"], "query": [ { "key": "identifier", @@ -1307,12 +1245,8 @@ ], "url": { "raw": "{{api_base_url}}/RelatedPerson?identifier=9000000041", - "host": [ - "{{api_base_url}}" - ], - "path": [ - "RelatedPerson" - ], + "host": ["{{api_base_url}}"], + "path": ["RelatedPerson"], "query": [ { "key": "identifier", @@ -1652,12 +1586,8 @@ "header": [], "url": { "raw": "{{api_base_url}}/Consent?performer:identifier=9000000017&status=active&_include=Consent:performer&_include=Consent:patient", - "host": [ - "{{api_base_url}}" - ], - "path": [ - "Consent" - ], + "host": ["{{api_base_url}}"], + "path": ["Consent"], "query": [ { "key": "performer:identifier", @@ -1834,12 +1764,8 @@ "header": [], "url": { "raw": "{{api_base_url}}/Consent?performer:identifier=9000000017&status=inactive", - "host": [ - "{{api_base_url}}" - ], - "path": [ - "Consent" - ], + "host": ["{{api_base_url}}"], + "path": ["Consent"], "query": [ { "key": "performer:identifier", @@ -2116,12 +2042,8 @@ "header": [], "url": { "raw": "{{api_base_url}}/Consent?performer:identifier=9000000017&status=proposed&status=active&_include=Consent:patient", - "host": [ - "{{api_base_url}}" - ], - "path": [ - "Consent" - ], + "host": ["{{api_base_url}}"], + "path": ["Consent"], "query": [ { "key": "performer:identifier", @@ -2346,12 +2268,8 @@ "header": [], "url": { "raw": "{{api_base_url}}/Consent?performer:identifier=9000000022", - "host": [ - "{{api_base_url}}" - ], - "path": [ - "Consent" - ], + "host": ["{{api_base_url}}"], + "path": ["Consent"], "query": [ { "key": "performer:identifier", @@ -2709,12 +2627,8 @@ "header": [], "url": { "raw": "{{api_base_url}}/Consent?performer:identifier=9000000022&_include=Consent:patient", - "host": [ - "{{api_base_url}}" - ], - "path": [ - "Consent" - ], + "host": ["{{api_base_url}}"], + "path": ["Consent"], "query": [ { "key": "performer:identifier", @@ -3051,12 +2965,8 @@ "header": [], "url": { "raw": "{{api_base_url}}/Consent?performer:identifier=9000000022&_include=Consent:performer", - "host": [ - "{{api_base_url}}" - ], - "path": [ - "Consent" - ], + "host": ["{{api_base_url}}"], + "path": ["Consent"], "query": [ { "key": "performer:identifier", @@ -3538,12 +3448,8 @@ "header": [], "url": { "raw": "{{api_base_url}}/Consent?performer:identifier=9000000022&_include=Consent:performer&_include=Consent:patient", - "host": [ - "{{api_base_url}}" - ], - "path": [ - "Consent" - ], + "host": ["{{api_base_url}}"], + "path": ["Consent"], "query": [ { "key": "performer:identifier", @@ -3765,12 +3671,8 @@ "header": [], "url": { "raw": "{{api_base_url}}/Consent?patient:identifier=9000000100", - "host": [ - "{{api_base_url}}" - ], - "path": [ - "Consent" - ], + "host": ["{{api_base_url}}"], + "path": ["Consent"], "query": [ { "key": "patient:identifier", @@ -4150,12 +4052,8 @@ "header": [], "url": { "raw": "{{api_base_url}}/Consent?patient:identifier=9000000100&_include=Consent:performer&_include=Consent:patient", - "host": [ - "{{api_base_url}}" - ], - "path": [ - "Consent" - ], + "host": ["{{api_base_url}}"], + "path": ["Consent"], "query": [ { "key": "patient:identifier", @@ -4496,12 +4394,8 @@ "header": [], "url": { "raw": "{{api_base_url}}/Consent?patient:identifier=9000000100&_include=Consent:performer", - "host": [ - "{{api_base_url}}" - ], - "path": [ - "Consent" - ], + "host": ["{{api_base_url}}"], + "path": ["Consent"], "query": [ { "key": "patient:identifier", @@ -4766,12 +4660,8 @@ "header": [], "url": { "raw": "{{api_base_url}}/Consent?patient:identifier=9000000100&_include=Consent:patient", - "host": [ - "{{api_base_url}}" - ], - "path": [ - "Consent" - ], + "host": ["{{api_base_url}}"], + "path": ["Consent"], "query": [ { "key": "patient:identifier", @@ -4819,12 +4709,8 @@ "header": [], "url": { "raw": "{{api_base_url}}/Consent?performer:identifier=9000000025", - "host": [ - "{{api_base_url}}" - ], - "path": [ - "Consent" - ], + "host": ["{{api_base_url}}"], + "path": ["Consent"], "query": [ { "key": "performer:identifier", @@ -4929,12 +4815,8 @@ "header": [], "url": { "raw": "{{api_base_url}}/Consent?performer:identifier=9000000010", - "host": [ - "{{api_base_url}}" - ], - "path": [ - "Consent" - ], + "host": ["{{api_base_url}}"], + "path": ["Consent"], "query": [ { "key": "performer:identifier", @@ -5124,12 +5006,8 @@ "header": [], "url": { "raw": "{{api_base_url}}/Consent?performer:identifier=9000000010&_include=Consent:performer&_include=Consent:patient", - "host": [ - "{{api_base_url}}" - ], - "path": [ - "Consent" - ], + "host": ["{{api_base_url}}"], + "path": ["Consent"], "query": [ { "key": "performer:identifier", @@ -5230,12 +5108,8 @@ "header": [], "url": { "raw": "{{api_base_url}}/Consent?performer:identifier=9000000019", - "host": [ - "{{api_base_url}}" - ], - "path": [ - "Consent" - ], + "host": ["{{api_base_url}}"], + "path": ["Consent"], "query": [ { "key": "performer:identifier", @@ -5423,12 +5297,8 @@ "header": [], "url": { "raw": "{{api_base_url}}/Consent?performer:identifier=9000000019&_include=Consent:performer&_include=Consent:patient", - "host": [ - "{{api_base_url}}" - ], - "path": [ - "Consent" - ], + "host": ["{{api_base_url}}"], + "path": ["Consent"], "query": [ { "key": "performer:identifier", @@ -5495,12 +5365,8 @@ "header": [], "url": { "raw": "{{api_base_url}}/Consent?performer:identifier=9000000017&status=test", - "host": [ - "{{api_base_url}}" - ], - "path": [ - "Consent" - ], + "host": ["{{api_base_url}}"], + "path": ["Consent"], "query": [ { "key": "performer:identifier", @@ -5567,12 +5433,8 @@ "header": [], "url": { "raw": "{{api_base_url}}/Consent?performer:identifier=9000000019&_include=test", - "host": [ - "{{api_base_url}}" - ], - "path": [ - "Consent" - ], + "host": ["{{api_base_url}}"], + "path": ["Consent"], "query": [ { "key": "performer:identifier", @@ -5637,12 +5499,8 @@ "header": [], "url": { "raw": "{{api_base_url}}/Consent?performer:identifier=9000000999", - "host": [ - "{{api_base_url}}" - ], - "path": [ - "Consent" - ], + "host": ["{{api_base_url}}"], + "path": ["Consent"], "query": [ { "key": "performer:identifier", @@ -5705,12 +5563,8 @@ "header": [], "url": { "raw": "{{api_base_url}}/Consent?performer:identifier=90000009990", - "host": [ - "{{api_base_url}}" - ], - "path": [ - "Consent" - ], + "host": ["{{api_base_url}}"], + "path": ["Consent"], "query": [ { "key": "performer:identifier", @@ -5773,12 +5627,8 @@ "header": [], "url": { "raw": "{{api_base_url}}/Consent?performer:identifier=https://fhir.nhs.uk/Id/nhs-number|1234567890", - "host": [ - "{{api_base_url}}" - ], - "path": [ - "Consent" - ], + "host": ["{{api_base_url}}"], + "path": ["Consent"], "query": [ { "key": "performer:identifier", @@ -5841,12 +5691,8 @@ "header": [], "url": { "raw": "{{api_base_url}}/Consent", - "host": [ - "{{api_base_url}}" - ], - "path": [ - "Consent" - ] + "host": ["{{api_base_url}}"], + "path": ["Consent"] } }, "response": [] @@ -5902,12 +5748,8 @@ "header": [], "url": { "raw": "{{api_base_url}}/Consent?performer:identifier=9000000012", - "host": [ - "{{api_base_url}}" - ], - "path": [ - "Consent" - ], + "host": ["{{api_base_url}}"], + "path": ["Consent"], "query": [ { "key": "performer:identifier", @@ -5973,12 +5815,8 @@ }, "url": { "raw": "{{api_base_url}}/Consent", - "host": [ - "{{api_base_url}}" - ], - "path": [ - "Consent" - ] + "host": ["{{api_base_url}}"], + "path": ["Consent"] } }, "response": [] @@ -6032,12 +5870,8 @@ }, "url": { "raw": "{{api_base_url}}/Consent", - "host": [ - "{{api_base_url}}" - ], - "path": [ - "Consent" - ] + "host": ["{{api_base_url}}"], + "path": ["Consent"] } }, "response": [] @@ -6099,12 +5933,8 @@ }, "url": { "raw": "{{api_base_url}}/Consent", - "host": [ - "{{api_base_url}}" - ], - "path": [ - "Consent" - ] + "host": ["{{api_base_url}}"], + "path": ["Consent"] } }, "response": [] @@ -6166,12 +5996,8 @@ }, "url": { "raw": "{{api_base_url}}/Consent", - "host": [ - "{{api_base_url}}" - ], - "path": [ - "Consent" - ] + "host": ["{{api_base_url}}"], + "path": ["Consent"] } }, "response": [] @@ -6227,13 +6053,8 @@ }, "url": { "raw": "{{api_base_url}}/Consent/c6f48e4d", - "host": [ - "{{api_base_url}}" - ], - "path": [ - "Consent", - "c6f48e4d" - ] + "host": ["{{api_base_url}}"], + "path": ["Consent", "c6f48e4d"] }, "description": "Valid patch changing status to 'active'" }, @@ -6284,13 +6105,8 @@ }, "url": { "raw": "{{api_base_url}}/Consent/0c56a594", - "host": [ - "{{api_base_url}}" - ], - "path": [ - "Consent", - "0c56a594" - ] + "host": ["{{api_base_url}}"], + "path": ["Consent", "0c56a594"] }, "description": "Valid patch modifying the role end date" }, @@ -6341,13 +6157,8 @@ }, "url": { "raw": "{{api_base_url}}/Consent/b02ea26c", - "host": [ - "{{api_base_url}}" - ], - "path": [ - "Consent", - "b02ea26c" - ] + "host": ["{{api_base_url}}"], + "path": ["Consent", "b02ea26c"] }, "description": "Valid patch modifying the role end date" }, @@ -6409,13 +6220,8 @@ }, "url": { "raw": "{{api_base_url}}/Consent/6fb4361b", - "host": [ - "{{api_base_url}}" - ], - "path": [ - "Consent", - "6fb4361b" - ] + "host": ["{{api_base_url}}"], + "path": ["Consent", "6fb4361b"] }, "description": "Patch with invalid status value" }, @@ -6477,13 +6283,8 @@ }, "url": { "raw": "{{api_base_url}}/Consent/94df7c8f", - "host": [ - "{{api_base_url}}" - ], - "path": [ - "Consent", - "94df7c8f" - ] + "host": ["{{api_base_url}}"], + "path": ["Consent", "94df7c8f"] }, "description": "Patch targeting non-existent element" }, @@ -6545,13 +6346,8 @@ }, "url": { "raw": "{{api_base_url}}/Consent/0000000", - "host": [ - "{{api_base_url}}" - ], - "path": [ - "Consent", - "0000000" - ] + "host": ["{{api_base_url}}"], + "path": ["Consent", "0000000"] }, "description": "Patch for non-existent Consent" }, @@ -6613,13 +6409,8 @@ }, "url": { "raw": "{{api_base_url}}/Consent/3a2679eb", - "host": [ - "{{api_base_url}}" - ], - "path": [ - "Consent", - "3a2679eb" - ] + "host": ["{{api_base_url}}"], + "path": ["Consent", "3a2679eb"] }, "description": "Malformed JSON patch document" }, @@ -6681,13 +6472,8 @@ }, "url": { "raw": "{{api_base_url}}/Consent/3a2679eb", - "host": [ - "{{api_base_url}}" - ], - "path": [ - "Consent", - "3a2679eb" - ] + "host": ["{{api_base_url}}"], + "path": ["Consent", "3a2679eb"] }, "description": "Malformed JSON patch document" }, @@ -6920,12 +6706,8 @@ ], "url": { "raw": "{{api_base_url}}/QuestionnaireResponse?referenceCode=19318ZGLAB", - "host": [ - "{{api_base_url}}" - ], - "path": [ - "QuestionnaireResponse" - ], + "host": ["{{api_base_url}}"], + "path": ["QuestionnaireResponse"], "query": [ { "key": "referenceCode", @@ -6994,12 +6776,8 @@ ], "url": { "raw": "{{api_base_url}}/QuestionnaireResponse", - "host": [ - "{{api_base_url}}" - ], - "path": [ - "QuestionnaireResponse" - ] + "host": ["{{api_base_url}}"], + "path": ["QuestionnaireResponse"] }, "description": "Example of an error response when reference code is missing from request" }, @@ -7062,12 +6840,8 @@ ], "url": { "raw": "{{api_base_url}}/QuestionnaireResponse?referenceCode=INVALID", - "host": [ - "{{api_base_url}}" - ], - "path": [ - "QuestionnaireResponse" - ], + "host": ["{{api_base_url}}"], + "path": ["QuestionnaireResponse"], "query": [ { "key": "referenceCode", @@ -7136,12 +6910,8 @@ ], "url": { "raw": "{{api_base_url}}/QuestionnaireResponse?referenceCode=ABC123XY", - "host": [ - "{{api_base_url}}" - ], - "path": [ - "QuestionnaireResponse" - ], + "host": ["{{api_base_url}}"], + "path": ["QuestionnaireResponse"], "query": [ { "key": "referenceCode", @@ -7162,9 +6932,7 @@ "script": { "type": "text/javascript", "packages": {}, - "exec": [ - "" - ] + "exec": [""] } }, { @@ -7187,4 +6955,4 @@ "type": "string" } ] -} \ No newline at end of file +} diff --git a/proxies/live/apiproxy/resources/jsc/HealthCheck.SetResponse.js b/proxies/live/apiproxy/resources/jsc/HealthCheck.SetResponse.js index cff918fe..ce2f258f 100644 --- a/proxies/live/apiproxy/resources/jsc/HealthCheck.SetResponse.js +++ b/proxies/live/apiproxy/resources/jsc/HealthCheck.SetResponse.js @@ -1,39 +1,46 @@ -const apiproxy_revision = context.getVariable('apiproxy.revision'); +const apiproxy_revision = context.getVariable("apiproxy.revision"); -const healthcheck_status_code = context.getVariable('healthcheckResponse.status.code'); -const healthcheck_request_url = context.getVariable('healthcheckRequest.url'); -const healthcheck_failed = context.getVariable("servicecallout.ServiceCallout.CallHealthcheckEndpoint.failed"); +const healthcheck_status_code = context.getVariable( + "healthcheckResponse.status.code", +); +const healthcheck_request_url = context.getVariable("healthcheckRequest.url"); +const healthcheck_failed = context.getVariable( + "servicecallout.ServiceCallout.CallHealthcheckEndpoint.failed", +); function json_tryparse(raw) { - try { - return JSON.parse(raw); - } - catch (e) { - return raw; - } + try { + return JSON.parse(raw); + } catch (e) { + return raw; + } } -const healthcheck_content = json_tryparse(context.getVariable('healthcheckResponse.content')); -const healthcheck_status = (healthcheck_status_code/100 === 2) ? "pass" : "fail"; -const timeout = (healthcheck_status_code === null && healthcheck_failed) ? "true" : "false"; +const healthcheck_content = json_tryparse( + context.getVariable("healthcheckResponse.content"), +); +const healthcheck_status = + healthcheck_status_code / 100 === 2 ? "pass" : "fail"; +const timeout = + healthcheck_status_code === null && healthcheck_failed ? "true" : "false"; -const final_status = (healthcheck_status !== "pass") ? "fail" : "pass"; +const final_status = healthcheck_status !== "pass" ? "fail" : "pass"; const resp = { - "status" : final_status, - "version" : "{{ DEPLOYED_VERSION }}" , - "revision" : apiproxy_revision, - "releaseId" : "{{ RELEASE_RELEASEID }}", - "commitId": "{{ SOURCE_COMMIT_ID }}", - "checks" : { - "healthcheck" : { - "status": healthcheck_status, - "timeout" : timeout, - "responseCode" : healthcheck_status_code, - "outcome": healthcheck_content, - "links" : {"self": healthcheck_request_url} - } - } + status: final_status, + version: "{{ DEPLOYED_VERSION }}", + revision: apiproxy_revision, + releaseId: "{{ RELEASE_RELEASEID }}", + commitId: "{{ SOURCE_COMMIT_ID }}", + checks: { + healthcheck: { + status: healthcheck_status, + timeout: timeout, + responseCode: healthcheck_status_code, + outcome: healthcheck_content, + links: { self: healthcheck_request_url }, + }, + }, }; context.setVariable("status.response", JSON.stringify(resp)); diff --git a/proxies/sandbox/apiproxy/resources/jsc/HealthCheck.SetResponse.js b/proxies/sandbox/apiproxy/resources/jsc/HealthCheck.SetResponse.js index cff918fe..ce2f258f 100644 --- a/proxies/sandbox/apiproxy/resources/jsc/HealthCheck.SetResponse.js +++ b/proxies/sandbox/apiproxy/resources/jsc/HealthCheck.SetResponse.js @@ -1,39 +1,46 @@ -const apiproxy_revision = context.getVariable('apiproxy.revision'); +const apiproxy_revision = context.getVariable("apiproxy.revision"); -const healthcheck_status_code = context.getVariable('healthcheckResponse.status.code'); -const healthcheck_request_url = context.getVariable('healthcheckRequest.url'); -const healthcheck_failed = context.getVariable("servicecallout.ServiceCallout.CallHealthcheckEndpoint.failed"); +const healthcheck_status_code = context.getVariable( + "healthcheckResponse.status.code", +); +const healthcheck_request_url = context.getVariable("healthcheckRequest.url"); +const healthcheck_failed = context.getVariable( + "servicecallout.ServiceCallout.CallHealthcheckEndpoint.failed", +); function json_tryparse(raw) { - try { - return JSON.parse(raw); - } - catch (e) { - return raw; - } + try { + return JSON.parse(raw); + } catch (e) { + return raw; + } } -const healthcheck_content = json_tryparse(context.getVariable('healthcheckResponse.content')); -const healthcheck_status = (healthcheck_status_code/100 === 2) ? "pass" : "fail"; -const timeout = (healthcheck_status_code === null && healthcheck_failed) ? "true" : "false"; +const healthcheck_content = json_tryparse( + context.getVariable("healthcheckResponse.content"), +); +const healthcheck_status = + healthcheck_status_code / 100 === 2 ? "pass" : "fail"; +const timeout = + healthcheck_status_code === null && healthcheck_failed ? "true" : "false"; -const final_status = (healthcheck_status !== "pass") ? "fail" : "pass"; +const final_status = healthcheck_status !== "pass" ? "fail" : "pass"; const resp = { - "status" : final_status, - "version" : "{{ DEPLOYED_VERSION }}" , - "revision" : apiproxy_revision, - "releaseId" : "{{ RELEASE_RELEASEID }}", - "commitId": "{{ SOURCE_COMMIT_ID }}", - "checks" : { - "healthcheck" : { - "status": healthcheck_status, - "timeout" : timeout, - "responseCode" : healthcheck_status_code, - "outcome": healthcheck_content, - "links" : {"self": healthcheck_request_url} - } - } + status: final_status, + version: "{{ DEPLOYED_VERSION }}", + revision: apiproxy_revision, + releaseId: "{{ RELEASE_RELEASEID }}", + commitId: "{{ SOURCE_COMMIT_ID }}", + checks: { + healthcheck: { + status: healthcheck_status, + timeout: timeout, + responseCode: healthcheck_status_code, + outcome: healthcheck_content, + links: { self: healthcheck_request_url }, + }, + }, }; context.setVariable("status.response", JSON.stringify(resp)); diff --git a/sandbox/README.md b/sandbox/README.md index a87e223c..7f1cbfee 100644 --- a/sandbox/README.md +++ b/sandbox/README.md @@ -7,17 +7,17 @@ For more information about building sandbox APIs see the [API Producer Zone conf ## Table of Contents - [Sandbox](#sandbox) - - [Table of Contents](#table-of-contents) - - [Architecture](#architecture) - - [Prerequisites](#prerequisites) - - [Quick Start](#quick-start) - - [Installing dependencies](#installing-dependencies) - - [Starting the API](#starting-the-api) - - [Development](#development) - - [Starting the API with Hot Reloading](#starting-the-api-with-hot-reloading) - - [Testing](#testing) - - [Unit Tests](#unit-tests) - - [Useful commands](#useful-commands) + - [Table of Contents](#table-of-contents) + - [Architecture](#architecture) + - [Prerequisites](#prerequisites) + - [Quick Start](#quick-start) + - [Installing dependencies](#installing-dependencies) + - [Starting the API](#starting-the-api) + - [Development](#development) + - [Starting the API with Hot Reloading](#starting-the-api-with-hot-reloading) + - [Testing](#testing) + - [Unit Tests](#unit-tests) + - [Useful commands](#useful-commands) ## Architecture @@ -31,9 +31,9 @@ The [Postman Collection](./postman/Validate_Relationship_Service_Sandbox.postman ## Prerequisites -- Python 3.8 -- [Poetry](https://python-poetry.org/docs/) -- [Docker](https://docs.docker.com/get-docker/) +- Python 3.8 +- [Poetry](https://python-poetry.org/docs/) +- [Docker](https://docs.docker.com/get-docker/) ## Quick Start From 0204d3869db1713e2ff12d4ddab62c17baf9b65a Mon Sep 17 00:00:00 2001 From: github-actions <62281988+JackPlowman@users.noreply.github.com> Date: Thu, 29 May 2025 14:20:04 +0100 Subject: [PATCH 2/3] NPA-5054 Add Prettier Commit Check Job --- .github/workflows/prettier-checks.yml | 28 +++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 .github/workflows/prettier-checks.yml diff --git a/.github/workflows/prettier-checks.yml b/.github/workflows/prettier-checks.yml new file mode 100644 index 00000000..06233d73 --- /dev/null +++ b/.github/workflows/prettier-checks.yml @@ -0,0 +1,28 @@ +name: Prettier Checks +on: + pull_request: + branches: [master] +permissions: + contents: read +jobs: + PrettierChecks: + name: Prettier Checks + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + persist-credentials: false + - name: Setup Node + uses: actions/setup-node@v4 + with: + node-version: 22 + + - name: Install dependencies + shell: bash + run: npm install + + - name: Run Prettier + shell: bash + run: npx prettier --check . From 47055315270c8064be271bf929a7f7201d82a80b Mon Sep 17 00:00:00 2001 From: github-actions <62281988+JackPlowman@users.noreply.github.com> Date: Thu, 29 May 2025 14:24:48 +0100 Subject: [PATCH 3/3] NPA-5054 Revert Postman Changes --- .prettierignore | 2 + ...ip Service Sandbox.postman_collection.json | 458 +++++++++++++----- .../resources/jsc/HealthCheck.SetResponse.js | 63 ++- .../resources/jsc/HealthCheck.SetResponse.js | 63 ++- 4 files changed, 403 insertions(+), 183 deletions(-) diff --git a/.prettierignore b/.prettierignore index 99e60738..4923eeb2 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1,2 +1,4 @@ *.yaml *.yml +postman/* +*.js diff --git a/postman/Validate Relationship Service Sandbox.postman_collection.json b/postman/Validate Relationship Service Sandbox.postman_collection.json index 28e35e1b..cf5cab56 100644 --- a/postman/Validate Relationship Service Sandbox.postman_collection.json +++ b/postman/Validate Relationship Service Sandbox.postman_collection.json @@ -16,7 +16,9 @@ { "listen": "test", "script": { - "exec": [""], + "exec": [ + "" + ], "type": "text/javascript" } } @@ -51,8 +53,12 @@ }, "url": { "raw": "{{api_base_url}}/QuestionnaireResponse", - "host": ["{{api_base_url}}"], - "path": ["QuestionnaireResponse"] + "host": [ + "{{api_base_url}}" + ], + "path": [ + "QuestionnaireResponse" + ] }, "description": "Example of an adult to child access request with the reference code returned" }, @@ -64,7 +70,9 @@ { "listen": "test", "script": { - "exec": [""], + "exec": [ + "" + ], "type": "text/javascript" } } @@ -98,8 +106,12 @@ }, "url": { "raw": "{{api_base_url}}/QuestionnaireResponse", - "host": ["{{api_base_url}}"], - "path": ["QuestionnaireResponse"] + "host": [ + "{{api_base_url}}" + ], + "path": [ + "QuestionnaireResponse" + ] }, "description": "Example of an adult to adult access request where the patient can consent with the reference code returned" }, @@ -111,7 +123,9 @@ { "listen": "test", "script": { - "exec": [""], + "exec": [ + "" + ], "type": "text/javascript" } } @@ -145,8 +159,12 @@ }, "url": { "raw": "{{api_base_url}}/QuestionnaireResponse", - "host": ["{{api_base_url}}"], - "path": ["QuestionnaireResponse"] + "host": [ + "{{api_base_url}}" + ], + "path": [ + "QuestionnaireResponse" + ] }, "description": "Example of an adult to adult access request where the patient cannot consent with the reference code returned" }, @@ -158,7 +176,9 @@ { "listen": "test", "script": { - "exec": [""], + "exec": [ + "" + ], "type": "text/javascript" } } @@ -192,8 +212,12 @@ }, "url": { "raw": "{{api_base_url}}/QuestionnaireResponse", - "host": ["{{api_base_url}}"], - "path": ["QuestionnaireResponse"] + "host": [ + "{{api_base_url}}" + ], + "path": [ + "QuestionnaireResponse" + ] }, "description": "Example of an adult to adult access request where the patient is the applicant with the reference code returned" }, @@ -205,7 +229,9 @@ "listen": "prerequest", "script": { "type": "text/javascript", - "exec": [""] + "exec": [ + "" + ] } }, { @@ -367,8 +393,12 @@ ], "url": { "raw": "{{api_base_url}}/RelatedPerson?identifier=9000000017", - "host": ["{{api_base_url}}"], - "path": ["RelatedPerson"], + "host": [ + "{{api_base_url}}" + ], + "path": [ + "RelatedPerson" + ], "query": [ { "key": "identifier", @@ -566,8 +596,12 @@ ], "url": { "raw": "{{api_base_url}}/RelatedPerson?identifier=9000000017&_include=RelatedPerson:patient", - "host": ["{{api_base_url}}"], - "path": ["RelatedPerson"], + "host": [ + "{{api_base_url}}" + ], + "path": [ + "RelatedPerson" + ], "query": [ { "key": "identifier", @@ -632,8 +666,12 @@ ], "url": { "raw": "{{api_base_url}}/RelatedPerson?identifier=9000000033", - "host": ["{{api_base_url}}"], - "path": ["RelatedPerson"], + "host": [ + "{{api_base_url}}" + ], + "path": [ + "RelatedPerson" + ], "query": [ { "key": "identifier", @@ -731,8 +769,12 @@ ], "url": { "raw": "{{api_base_url}}/RelatedPerson?identifier=9000000017&patient:identifier=9000000009", - "host": ["{{api_base_url}}"], - "path": ["RelatedPerson"], + "host": [ + "{{api_base_url}}" + ], + "path": [ + "RelatedPerson" + ], "query": [ { "key": "identifier", @@ -867,8 +909,12 @@ ], "url": { "raw": "{{api_base_url}}/RelatedPerson?identifier=9000000017&patient:identifier=9000000009&_include=RelatedPerson:patient", - "host": ["{{api_base_url}}"], - "path": ["RelatedPerson"], + "host": [ + "{{api_base_url}}" + ], + "path": [ + "RelatedPerson" + ], "query": [ { "key": "identifier", @@ -951,8 +997,12 @@ ], "url": { "raw": "{{api_base_url}}/RelatedPerson", - "host": ["{{api_base_url}}"], - "path": ["RelatedPerson"] + "host": [ + "{{api_base_url}}" + ], + "path": [ + "RelatedPerson" + ] }, "description": "Example of an error response when the NHS number is missing" }, @@ -1022,8 +1072,12 @@ ], "url": { "raw": "{{api_base_url}}/RelatedPerson?identifier=900000000", - "host": ["{{api_base_url}}"], - "path": ["RelatedPerson"], + "host": [ + "{{api_base_url}}" + ], + "path": [ + "RelatedPerson" + ], "query": [ { "key": "identifier", @@ -1097,8 +1151,12 @@ ], "url": { "raw": "{{api_base_url}}/RelatedPerson?identifier=https://fhir.nhs.uk/Id/nhs-number|A730675929", - "host": ["{{api_base_url}}"], - "path": ["RelatedPerson"], + "host": [ + "{{api_base_url}}" + ], + "path": [ + "RelatedPerson" + ], "query": [ { "key": "identifier", @@ -1171,8 +1229,12 @@ ], "url": { "raw": "{{api_base_url}}/RelatedPerson?identifier=1000000001", - "host": ["{{api_base_url}}"], - "path": ["RelatedPerson"], + "host": [ + "{{api_base_url}}" + ], + "path": [ + "RelatedPerson" + ], "query": [ { "key": "identifier", @@ -1245,8 +1307,12 @@ ], "url": { "raw": "{{api_base_url}}/RelatedPerson?identifier=9000000041", - "host": ["{{api_base_url}}"], - "path": ["RelatedPerson"], + "host": [ + "{{api_base_url}}" + ], + "path": [ + "RelatedPerson" + ], "query": [ { "key": "identifier", @@ -1586,8 +1652,12 @@ "header": [], "url": { "raw": "{{api_base_url}}/Consent?performer:identifier=9000000017&status=active&_include=Consent:performer&_include=Consent:patient", - "host": ["{{api_base_url}}"], - "path": ["Consent"], + "host": [ + "{{api_base_url}}" + ], + "path": [ + "Consent" + ], "query": [ { "key": "performer:identifier", @@ -1764,8 +1834,12 @@ "header": [], "url": { "raw": "{{api_base_url}}/Consent?performer:identifier=9000000017&status=inactive", - "host": ["{{api_base_url}}"], - "path": ["Consent"], + "host": [ + "{{api_base_url}}" + ], + "path": [ + "Consent" + ], "query": [ { "key": "performer:identifier", @@ -2042,8 +2116,12 @@ "header": [], "url": { "raw": "{{api_base_url}}/Consent?performer:identifier=9000000017&status=proposed&status=active&_include=Consent:patient", - "host": ["{{api_base_url}}"], - "path": ["Consent"], + "host": [ + "{{api_base_url}}" + ], + "path": [ + "Consent" + ], "query": [ { "key": "performer:identifier", @@ -2268,8 +2346,12 @@ "header": [], "url": { "raw": "{{api_base_url}}/Consent?performer:identifier=9000000022", - "host": ["{{api_base_url}}"], - "path": ["Consent"], + "host": [ + "{{api_base_url}}" + ], + "path": [ + "Consent" + ], "query": [ { "key": "performer:identifier", @@ -2627,8 +2709,12 @@ "header": [], "url": { "raw": "{{api_base_url}}/Consent?performer:identifier=9000000022&_include=Consent:patient", - "host": ["{{api_base_url}}"], - "path": ["Consent"], + "host": [ + "{{api_base_url}}" + ], + "path": [ + "Consent" + ], "query": [ { "key": "performer:identifier", @@ -2965,8 +3051,12 @@ "header": [], "url": { "raw": "{{api_base_url}}/Consent?performer:identifier=9000000022&_include=Consent:performer", - "host": ["{{api_base_url}}"], - "path": ["Consent"], + "host": [ + "{{api_base_url}}" + ], + "path": [ + "Consent" + ], "query": [ { "key": "performer:identifier", @@ -3448,8 +3538,12 @@ "header": [], "url": { "raw": "{{api_base_url}}/Consent?performer:identifier=9000000022&_include=Consent:performer&_include=Consent:patient", - "host": ["{{api_base_url}}"], - "path": ["Consent"], + "host": [ + "{{api_base_url}}" + ], + "path": [ + "Consent" + ], "query": [ { "key": "performer:identifier", @@ -3671,8 +3765,12 @@ "header": [], "url": { "raw": "{{api_base_url}}/Consent?patient:identifier=9000000100", - "host": ["{{api_base_url}}"], - "path": ["Consent"], + "host": [ + "{{api_base_url}}" + ], + "path": [ + "Consent" + ], "query": [ { "key": "patient:identifier", @@ -4052,8 +4150,12 @@ "header": [], "url": { "raw": "{{api_base_url}}/Consent?patient:identifier=9000000100&_include=Consent:performer&_include=Consent:patient", - "host": ["{{api_base_url}}"], - "path": ["Consent"], + "host": [ + "{{api_base_url}}" + ], + "path": [ + "Consent" + ], "query": [ { "key": "patient:identifier", @@ -4394,8 +4496,12 @@ "header": [], "url": { "raw": "{{api_base_url}}/Consent?patient:identifier=9000000100&_include=Consent:performer", - "host": ["{{api_base_url}}"], - "path": ["Consent"], + "host": [ + "{{api_base_url}}" + ], + "path": [ + "Consent" + ], "query": [ { "key": "patient:identifier", @@ -4660,8 +4766,12 @@ "header": [], "url": { "raw": "{{api_base_url}}/Consent?patient:identifier=9000000100&_include=Consent:patient", - "host": ["{{api_base_url}}"], - "path": ["Consent"], + "host": [ + "{{api_base_url}}" + ], + "path": [ + "Consent" + ], "query": [ { "key": "patient:identifier", @@ -4709,8 +4819,12 @@ "header": [], "url": { "raw": "{{api_base_url}}/Consent?performer:identifier=9000000025", - "host": ["{{api_base_url}}"], - "path": ["Consent"], + "host": [ + "{{api_base_url}}" + ], + "path": [ + "Consent" + ], "query": [ { "key": "performer:identifier", @@ -4815,8 +4929,12 @@ "header": [], "url": { "raw": "{{api_base_url}}/Consent?performer:identifier=9000000010", - "host": ["{{api_base_url}}"], - "path": ["Consent"], + "host": [ + "{{api_base_url}}" + ], + "path": [ + "Consent" + ], "query": [ { "key": "performer:identifier", @@ -5006,8 +5124,12 @@ "header": [], "url": { "raw": "{{api_base_url}}/Consent?performer:identifier=9000000010&_include=Consent:performer&_include=Consent:patient", - "host": ["{{api_base_url}}"], - "path": ["Consent"], + "host": [ + "{{api_base_url}}" + ], + "path": [ + "Consent" + ], "query": [ { "key": "performer:identifier", @@ -5108,8 +5230,12 @@ "header": [], "url": { "raw": "{{api_base_url}}/Consent?performer:identifier=9000000019", - "host": ["{{api_base_url}}"], - "path": ["Consent"], + "host": [ + "{{api_base_url}}" + ], + "path": [ + "Consent" + ], "query": [ { "key": "performer:identifier", @@ -5297,8 +5423,12 @@ "header": [], "url": { "raw": "{{api_base_url}}/Consent?performer:identifier=9000000019&_include=Consent:performer&_include=Consent:patient", - "host": ["{{api_base_url}}"], - "path": ["Consent"], + "host": [ + "{{api_base_url}}" + ], + "path": [ + "Consent" + ], "query": [ { "key": "performer:identifier", @@ -5365,8 +5495,12 @@ "header": [], "url": { "raw": "{{api_base_url}}/Consent?performer:identifier=9000000017&status=test", - "host": ["{{api_base_url}}"], - "path": ["Consent"], + "host": [ + "{{api_base_url}}" + ], + "path": [ + "Consent" + ], "query": [ { "key": "performer:identifier", @@ -5433,8 +5567,12 @@ "header": [], "url": { "raw": "{{api_base_url}}/Consent?performer:identifier=9000000019&_include=test", - "host": ["{{api_base_url}}"], - "path": ["Consent"], + "host": [ + "{{api_base_url}}" + ], + "path": [ + "Consent" + ], "query": [ { "key": "performer:identifier", @@ -5499,8 +5637,12 @@ "header": [], "url": { "raw": "{{api_base_url}}/Consent?performer:identifier=9000000999", - "host": ["{{api_base_url}}"], - "path": ["Consent"], + "host": [ + "{{api_base_url}}" + ], + "path": [ + "Consent" + ], "query": [ { "key": "performer:identifier", @@ -5563,8 +5705,12 @@ "header": [], "url": { "raw": "{{api_base_url}}/Consent?performer:identifier=90000009990", - "host": ["{{api_base_url}}"], - "path": ["Consent"], + "host": [ + "{{api_base_url}}" + ], + "path": [ + "Consent" + ], "query": [ { "key": "performer:identifier", @@ -5627,8 +5773,12 @@ "header": [], "url": { "raw": "{{api_base_url}}/Consent?performer:identifier=https://fhir.nhs.uk/Id/nhs-number|1234567890", - "host": ["{{api_base_url}}"], - "path": ["Consent"], + "host": [ + "{{api_base_url}}" + ], + "path": [ + "Consent" + ], "query": [ { "key": "performer:identifier", @@ -5691,8 +5841,12 @@ "header": [], "url": { "raw": "{{api_base_url}}/Consent", - "host": ["{{api_base_url}}"], - "path": ["Consent"] + "host": [ + "{{api_base_url}}" + ], + "path": [ + "Consent" + ] } }, "response": [] @@ -5748,8 +5902,12 @@ "header": [], "url": { "raw": "{{api_base_url}}/Consent?performer:identifier=9000000012", - "host": ["{{api_base_url}}"], - "path": ["Consent"], + "host": [ + "{{api_base_url}}" + ], + "path": [ + "Consent" + ], "query": [ { "key": "performer:identifier", @@ -5815,8 +5973,12 @@ }, "url": { "raw": "{{api_base_url}}/Consent", - "host": ["{{api_base_url}}"], - "path": ["Consent"] + "host": [ + "{{api_base_url}}" + ], + "path": [ + "Consent" + ] } }, "response": [] @@ -5870,8 +6032,12 @@ }, "url": { "raw": "{{api_base_url}}/Consent", - "host": ["{{api_base_url}}"], - "path": ["Consent"] + "host": [ + "{{api_base_url}}" + ], + "path": [ + "Consent" + ] } }, "response": [] @@ -5933,8 +6099,12 @@ }, "url": { "raw": "{{api_base_url}}/Consent", - "host": ["{{api_base_url}}"], - "path": ["Consent"] + "host": [ + "{{api_base_url}}" + ], + "path": [ + "Consent" + ] } }, "response": [] @@ -5996,8 +6166,12 @@ }, "url": { "raw": "{{api_base_url}}/Consent", - "host": ["{{api_base_url}}"], - "path": ["Consent"] + "host": [ + "{{api_base_url}}" + ], + "path": [ + "Consent" + ] } }, "response": [] @@ -6053,8 +6227,13 @@ }, "url": { "raw": "{{api_base_url}}/Consent/c6f48e4d", - "host": ["{{api_base_url}}"], - "path": ["Consent", "c6f48e4d"] + "host": [ + "{{api_base_url}}" + ], + "path": [ + "Consent", + "c6f48e4d" + ] }, "description": "Valid patch changing status to 'active'" }, @@ -6105,8 +6284,13 @@ }, "url": { "raw": "{{api_base_url}}/Consent/0c56a594", - "host": ["{{api_base_url}}"], - "path": ["Consent", "0c56a594"] + "host": [ + "{{api_base_url}}" + ], + "path": [ + "Consent", + "0c56a594" + ] }, "description": "Valid patch modifying the role end date" }, @@ -6157,8 +6341,13 @@ }, "url": { "raw": "{{api_base_url}}/Consent/b02ea26c", - "host": ["{{api_base_url}}"], - "path": ["Consent", "b02ea26c"] + "host": [ + "{{api_base_url}}" + ], + "path": [ + "Consent", + "b02ea26c" + ] }, "description": "Valid patch modifying the role end date" }, @@ -6220,8 +6409,13 @@ }, "url": { "raw": "{{api_base_url}}/Consent/6fb4361b", - "host": ["{{api_base_url}}"], - "path": ["Consent", "6fb4361b"] + "host": [ + "{{api_base_url}}" + ], + "path": [ + "Consent", + "6fb4361b" + ] }, "description": "Patch with invalid status value" }, @@ -6283,8 +6477,13 @@ }, "url": { "raw": "{{api_base_url}}/Consent/94df7c8f", - "host": ["{{api_base_url}}"], - "path": ["Consent", "94df7c8f"] + "host": [ + "{{api_base_url}}" + ], + "path": [ + "Consent", + "94df7c8f" + ] }, "description": "Patch targeting non-existent element" }, @@ -6346,8 +6545,13 @@ }, "url": { "raw": "{{api_base_url}}/Consent/0000000", - "host": ["{{api_base_url}}"], - "path": ["Consent", "0000000"] + "host": [ + "{{api_base_url}}" + ], + "path": [ + "Consent", + "0000000" + ] }, "description": "Patch for non-existent Consent" }, @@ -6409,8 +6613,13 @@ }, "url": { "raw": "{{api_base_url}}/Consent/3a2679eb", - "host": ["{{api_base_url}}"], - "path": ["Consent", "3a2679eb"] + "host": [ + "{{api_base_url}}" + ], + "path": [ + "Consent", + "3a2679eb" + ] }, "description": "Malformed JSON patch document" }, @@ -6472,8 +6681,13 @@ }, "url": { "raw": "{{api_base_url}}/Consent/3a2679eb", - "host": ["{{api_base_url}}"], - "path": ["Consent", "3a2679eb"] + "host": [ + "{{api_base_url}}" + ], + "path": [ + "Consent", + "3a2679eb" + ] }, "description": "Malformed JSON patch document" }, @@ -6706,8 +6920,12 @@ ], "url": { "raw": "{{api_base_url}}/QuestionnaireResponse?referenceCode=19318ZGLAB", - "host": ["{{api_base_url}}"], - "path": ["QuestionnaireResponse"], + "host": [ + "{{api_base_url}}" + ], + "path": [ + "QuestionnaireResponse" + ], "query": [ { "key": "referenceCode", @@ -6776,8 +6994,12 @@ ], "url": { "raw": "{{api_base_url}}/QuestionnaireResponse", - "host": ["{{api_base_url}}"], - "path": ["QuestionnaireResponse"] + "host": [ + "{{api_base_url}}" + ], + "path": [ + "QuestionnaireResponse" + ] }, "description": "Example of an error response when reference code is missing from request" }, @@ -6840,8 +7062,12 @@ ], "url": { "raw": "{{api_base_url}}/QuestionnaireResponse?referenceCode=INVALID", - "host": ["{{api_base_url}}"], - "path": ["QuestionnaireResponse"], + "host": [ + "{{api_base_url}}" + ], + "path": [ + "QuestionnaireResponse" + ], "query": [ { "key": "referenceCode", @@ -6910,8 +7136,12 @@ ], "url": { "raw": "{{api_base_url}}/QuestionnaireResponse?referenceCode=ABC123XY", - "host": ["{{api_base_url}}"], - "path": ["QuestionnaireResponse"], + "host": [ + "{{api_base_url}}" + ], + "path": [ + "QuestionnaireResponse" + ], "query": [ { "key": "referenceCode", @@ -6932,7 +7162,9 @@ "script": { "type": "text/javascript", "packages": {}, - "exec": [""] + "exec": [ + "" + ] } }, { @@ -6955,4 +7187,4 @@ "type": "string" } ] -} +} \ No newline at end of file diff --git a/proxies/live/apiproxy/resources/jsc/HealthCheck.SetResponse.js b/proxies/live/apiproxy/resources/jsc/HealthCheck.SetResponse.js index ce2f258f..cff918fe 100644 --- a/proxies/live/apiproxy/resources/jsc/HealthCheck.SetResponse.js +++ b/proxies/live/apiproxy/resources/jsc/HealthCheck.SetResponse.js @@ -1,46 +1,39 @@ -const apiproxy_revision = context.getVariable("apiproxy.revision"); +const apiproxy_revision = context.getVariable('apiproxy.revision'); -const healthcheck_status_code = context.getVariable( - "healthcheckResponse.status.code", -); -const healthcheck_request_url = context.getVariable("healthcheckRequest.url"); -const healthcheck_failed = context.getVariable( - "servicecallout.ServiceCallout.CallHealthcheckEndpoint.failed", -); +const healthcheck_status_code = context.getVariable('healthcheckResponse.status.code'); +const healthcheck_request_url = context.getVariable('healthcheckRequest.url'); +const healthcheck_failed = context.getVariable("servicecallout.ServiceCallout.CallHealthcheckEndpoint.failed"); function json_tryparse(raw) { - try { - return JSON.parse(raw); - } catch (e) { - return raw; - } + try { + return JSON.parse(raw); + } + catch (e) { + return raw; + } } -const healthcheck_content = json_tryparse( - context.getVariable("healthcheckResponse.content"), -); -const healthcheck_status = - healthcheck_status_code / 100 === 2 ? "pass" : "fail"; -const timeout = - healthcheck_status_code === null && healthcheck_failed ? "true" : "false"; +const healthcheck_content = json_tryparse(context.getVariable('healthcheckResponse.content')); +const healthcheck_status = (healthcheck_status_code/100 === 2) ? "pass" : "fail"; +const timeout = (healthcheck_status_code === null && healthcheck_failed) ? "true" : "false"; -const final_status = healthcheck_status !== "pass" ? "fail" : "pass"; +const final_status = (healthcheck_status !== "pass") ? "fail" : "pass"; const resp = { - status: final_status, - version: "{{ DEPLOYED_VERSION }}", - revision: apiproxy_revision, - releaseId: "{{ RELEASE_RELEASEID }}", - commitId: "{{ SOURCE_COMMIT_ID }}", - checks: { - healthcheck: { - status: healthcheck_status, - timeout: timeout, - responseCode: healthcheck_status_code, - outcome: healthcheck_content, - links: { self: healthcheck_request_url }, - }, - }, + "status" : final_status, + "version" : "{{ DEPLOYED_VERSION }}" , + "revision" : apiproxy_revision, + "releaseId" : "{{ RELEASE_RELEASEID }}", + "commitId": "{{ SOURCE_COMMIT_ID }}", + "checks" : { + "healthcheck" : { + "status": healthcheck_status, + "timeout" : timeout, + "responseCode" : healthcheck_status_code, + "outcome": healthcheck_content, + "links" : {"self": healthcheck_request_url} + } + } }; context.setVariable("status.response", JSON.stringify(resp)); diff --git a/proxies/sandbox/apiproxy/resources/jsc/HealthCheck.SetResponse.js b/proxies/sandbox/apiproxy/resources/jsc/HealthCheck.SetResponse.js index ce2f258f..cff918fe 100644 --- a/proxies/sandbox/apiproxy/resources/jsc/HealthCheck.SetResponse.js +++ b/proxies/sandbox/apiproxy/resources/jsc/HealthCheck.SetResponse.js @@ -1,46 +1,39 @@ -const apiproxy_revision = context.getVariable("apiproxy.revision"); +const apiproxy_revision = context.getVariable('apiproxy.revision'); -const healthcheck_status_code = context.getVariable( - "healthcheckResponse.status.code", -); -const healthcheck_request_url = context.getVariable("healthcheckRequest.url"); -const healthcheck_failed = context.getVariable( - "servicecallout.ServiceCallout.CallHealthcheckEndpoint.failed", -); +const healthcheck_status_code = context.getVariable('healthcheckResponse.status.code'); +const healthcheck_request_url = context.getVariable('healthcheckRequest.url'); +const healthcheck_failed = context.getVariable("servicecallout.ServiceCallout.CallHealthcheckEndpoint.failed"); function json_tryparse(raw) { - try { - return JSON.parse(raw); - } catch (e) { - return raw; - } + try { + return JSON.parse(raw); + } + catch (e) { + return raw; + } } -const healthcheck_content = json_tryparse( - context.getVariable("healthcheckResponse.content"), -); -const healthcheck_status = - healthcheck_status_code / 100 === 2 ? "pass" : "fail"; -const timeout = - healthcheck_status_code === null && healthcheck_failed ? "true" : "false"; +const healthcheck_content = json_tryparse(context.getVariable('healthcheckResponse.content')); +const healthcheck_status = (healthcheck_status_code/100 === 2) ? "pass" : "fail"; +const timeout = (healthcheck_status_code === null && healthcheck_failed) ? "true" : "false"; -const final_status = healthcheck_status !== "pass" ? "fail" : "pass"; +const final_status = (healthcheck_status !== "pass") ? "fail" : "pass"; const resp = { - status: final_status, - version: "{{ DEPLOYED_VERSION }}", - revision: apiproxy_revision, - releaseId: "{{ RELEASE_RELEASEID }}", - commitId: "{{ SOURCE_COMMIT_ID }}", - checks: { - healthcheck: { - status: healthcheck_status, - timeout: timeout, - responseCode: healthcheck_status_code, - outcome: healthcheck_content, - links: { self: healthcheck_request_url }, - }, - }, + "status" : final_status, + "version" : "{{ DEPLOYED_VERSION }}" , + "revision" : apiproxy_revision, + "releaseId" : "{{ RELEASE_RELEASEID }}", + "commitId": "{{ SOURCE_COMMIT_ID }}", + "checks" : { + "healthcheck" : { + "status": healthcheck_status, + "timeout" : timeout, + "responseCode" : healthcheck_status_code, + "outcome": healthcheck_content, + "links" : {"self": healthcheck_request_url} + } + } }; context.setVariable("status.response", JSON.stringify(resp));