diff --git a/.spectral.yaml b/.spectral.yaml index f95a3c8b63..4d3d4ad35e 100644 --- a/.spectral.yaml +++ b/.spectral.yaml @@ -81,4 +81,3 @@ rules: - required: [ format ] - required: [ pattern ] severity: warn - diff --git a/README.md b/README.md index 504bac508d..3cf361e6fe 100644 --- a/README.md +++ b/README.md @@ -393,28 +393,33 @@ Please see the separate [Dev environment](https://tools.hmcts.net/confluence/dis This repo contains overrides for the default dev environment configuration, controlled by PR labels. -## OpenAPI Specification and Data Schema Validation +### Supported labels + +| Label | Usages | +|------------------------|--------------------------------------------------------------------------------------------------| +| enable_darts_portal | Deploys a DARTS portal instance alongside the API in the dev environment | +| enable_darts_fullstack | Not yet supported, but will deploy the full DARTS stack alongside the API in the dev environment | -This repository uses spectral to validate OpenAPI specifications. To install spectral, you can use npm or yarn: +## OpenAPI Validation -https://docs.stoplight.io/docs/spectral/b8391e051b7d8-installation +The application uses OpenAPI validation to ensure that incoming requests and outgoing responses conform to the OpenAPI specification. To install the IBM OpenAPI +validator, you can use npm or yarn: + +https://github.com/IBM/openapi-validator?tab=readme-ov-file#installation -To validate the OpenAPI specification: +To enable OpenAPI validation, the following properties are set in the application configuration: ```bash -spectral lint --verbose "src/main/resources/openapi/**/*.{yml,yaml}" +lint-openapi "src/main/resources/openapi/**/*.yaml" ``` -Documentation: https://stoplight.io/open-source/spectral +For more information on OpenAPI validation with IBM openapi validator, see the [openapi validator](https://github.com/IBM/openapi-validator). -Validate the data payload JSON Schemas: +This OpenAPI validation uses spectral ruleset to validate. To install spectral, you can use npm or yarn: -### Supported labels +https://docs.stoplight.io/docs/spectral/b8391e051b7d8-installation -| Label | Usages | -|------------------------|--------------------------------------------------------------------------------------------------| -| enable_darts_portal | Deploys a DARTS portal instance alongside the API in the dev environment | -| enable_darts_fullstack | Not yet supported, but will deploy the full DARTS stack alongside the API in the dev environment | +Documentation: https://stoplight.io/open-source/spectral ## License diff --git a/lint-openapi-config.yaml b/lint-openapi-config.yaml new file mode 100644 index 0000000000..62875fc4ec --- /dev/null +++ b/lint-openapi-config.yaml @@ -0,0 +1,5 @@ +errorsOnly: false +limits: + warnings: 100 +outputFormat: 'json' +summaryOnly: true \ No newline at end of file