From 066bda0779da6b3073b4d2f509b37ff0455e31e7 Mon Sep 17 00:00:00 2001 From: David Young Date: Fri, 26 Jul 2024 15:35:54 +0100 Subject: [PATCH 1/5] Enable v1.5 in Sandbox Using the `pre` suffix should ensure this version is not seen in production --- app/lib/vendor_api.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/lib/vendor_api.rb b/app/lib/vendor_api.rb index 278ab570dc0..c1669ff1588 100644 --- a/app/lib/vendor_api.rb +++ b/app/lib/vendor_api.rb @@ -7,7 +7,7 @@ module VendorAPI VERSION_1_3 = '1.3'.freeze VERSION_1_4 = '1.4'.freeze VERSION_1_5 = '1.5pre'.freeze - VERSION = VERSION_1_4 + VERSION = '1.5'.freeze VERSIONS = { '1.0' => [ From 3349953c4a658f885cf57fd35b2a8963092593b0 Mon Sep 17 00:00:00 2001 From: David Young Date: Fri, 26 Jul 2024 16:26:53 +0100 Subject: [PATCH 2/5] Removed v1.5.yml OpenApi document Draft will act as the v1.5 documentation. This will be duplicated as `v1.5.yml` when the API is released to Production --- config/vendor_api/draft.yml | 1 + config/vendor_api/v1.5.yml | 46 ------------------------------------- 2 files changed, 1 insertion(+), 46 deletions(-) delete mode 100644 config/vendor_api/v1.5.yml diff --git a/config/vendor_api/draft.yml b/config/vendor_api/draft.yml index 0f0b5f43ed6..8ffd07a001b 100644 --- a/config/vendor_api/draft.yml +++ b/config/vendor_api/draft.yml @@ -19,6 +19,7 @@ components: schemas: ApplicationAttributes: type: object + additionalProperties: false properties: sent_to_provider_at: type: string diff --git a/config/vendor_api/v1.5.yml b/config/vendor_api/v1.5.yml deleted file mode 100644 index fe4cc25b613..00000000000 --- a/config/vendor_api/v1.5.yml +++ /dev/null @@ -1,46 +0,0 @@ ---- -openapi: 3.0.0 -info: - version: v1.5 - title: Apply API - contact: - name: DfE - email: becomingateacher@digital.education.gov.uk - description: | - API for DfE’s Apply for teacher training service. - Endpoints with the `/applications` prefix are considered stable. - Experimental endpoints prefixed with `/test-data` may change or be removed. -servers: - - description: Sandbox (test environment for vendors) - url: https://sandbox.apply-for-teacher-training.service.gov.uk/api/v1.5pre - - description: Production - url: https://www.apply-for-teacher-training.service.gov.uk/api/v1.5pre -components: - schemas: - ApplicationAttributes: - type: object - additionalProperties: false - properties: - sent_to_provider_at: - type: string - format: date-time - description: The date and time the application was sent to the provider - example: "2024-07-10T13:00:00+01:00" - submitted_at: - type: string - format: date-time - description: The date and time the Candidate first submitted in this cycle. See `sent_to_provider_at` for the date and time this specific Application was submitted. - example: "2019-06-13T10:44:31Z" - deprecated: true - required: - - sent_to_provider_at - Reference: - type: object - properties: - feedback_provided_at: - type: string - format: date-time - description: The date and time the reference was provided - example: "2024-07-10T13:00:00+01:00" - required: - - feedback_provided_at From 9306860d158c1fd618cc3bcd8e7cb6baab8a8d5f Mon Sep 17 00:00:00 2001 From: David Young Date: Fri, 26 Jul 2024 16:54:40 +0100 Subject: [PATCH 3/5] Revert "Removed v1.5.yml OpenApi document" This reverts commit 3349953c4a658f885cf57fd35b2a8963092593b0. --- config/vendor_api/draft.yml | 1 - config/vendor_api/v1.5.yml | 46 +++++++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 config/vendor_api/v1.5.yml diff --git a/config/vendor_api/draft.yml b/config/vendor_api/draft.yml index 8ffd07a001b..0f0b5f43ed6 100644 --- a/config/vendor_api/draft.yml +++ b/config/vendor_api/draft.yml @@ -19,7 +19,6 @@ components: schemas: ApplicationAttributes: type: object - additionalProperties: false properties: sent_to_provider_at: type: string diff --git a/config/vendor_api/v1.5.yml b/config/vendor_api/v1.5.yml new file mode 100644 index 00000000000..fe4cc25b613 --- /dev/null +++ b/config/vendor_api/v1.5.yml @@ -0,0 +1,46 @@ +--- +openapi: 3.0.0 +info: + version: v1.5 + title: Apply API + contact: + name: DfE + email: becomingateacher@digital.education.gov.uk + description: | + API for DfE’s Apply for teacher training service. + Endpoints with the `/applications` prefix are considered stable. + Experimental endpoints prefixed with `/test-data` may change or be removed. +servers: + - description: Sandbox (test environment for vendors) + url: https://sandbox.apply-for-teacher-training.service.gov.uk/api/v1.5pre + - description: Production + url: https://www.apply-for-teacher-training.service.gov.uk/api/v1.5pre +components: + schemas: + ApplicationAttributes: + type: object + additionalProperties: false + properties: + sent_to_provider_at: + type: string + format: date-time + description: The date and time the application was sent to the provider + example: "2024-07-10T13:00:00+01:00" + submitted_at: + type: string + format: date-time + description: The date and time the Candidate first submitted in this cycle. See `sent_to_provider_at` for the date and time this specific Application was submitted. + example: "2019-06-13T10:44:31Z" + deprecated: true + required: + - sent_to_provider_at + Reference: + type: object + properties: + feedback_provided_at: + type: string + format: date-time + description: The date and time the reference was provided + example: "2024-07-10T13:00:00+01:00" + required: + - feedback_provided_at From 9a81282f63894ae2434176a7635d3d149be94814 Mon Sep 17 00:00:00 2001 From: David Young Date: Fri, 26 Jul 2024 17:15:42 +0100 Subject: [PATCH 4/5] Remove `pre` from versions --- app/lib/vendor_api.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/lib/vendor_api.rb b/app/lib/vendor_api.rb index c1669ff1588..d5fe2941e21 100644 --- a/app/lib/vendor_api.rb +++ b/app/lib/vendor_api.rb @@ -61,7 +61,7 @@ module VendorAPI '1.4' => [ Changes::V14::AddGcseCompletingQualificationData, ], - '1.5pre' => [ + '1.5' => [ Changes::V15::AddApplicationSentToProviderDatetime, Changes::V15::AddReferenceFeedbackProvidedAtDatetime, ], From c9e320cfbed419a4cd73ad31bfc721d78d4b30e9 Mon Sep 17 00:00:00 2001 From: David Young Date: Mon, 29 Jul 2024 09:39:12 +0100 Subject: [PATCH 5/5] Updated specs to match expectations --- .../api_docs/vendor_api_docs/openapi_controller.rb | 6 +++++- spec/system/api_docs/api_docs_spec.rb | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/app/controllers/api_docs/vendor_api_docs/openapi_controller.rb b/app/controllers/api_docs/vendor_api_docs/openapi_controller.rb index 1aef922930b..07667ca16ca 100644 --- a/app/controllers/api_docs/vendor_api_docs/openapi_controller.rb +++ b/app/controllers/api_docs/vendor_api_docs/openapi_controller.rb @@ -10,7 +10,7 @@ def spec_draft end def spec_current - spec(version: VendorAPI::VERSION) + spec(version: AllowedCrossNamespaceUsage::VendorAPIInfo.released_version) end def spec_1_0 @@ -33,6 +33,10 @@ def spec_1_4 spec(version: VendorAPI::VERSION_1_4) end + def spec_1_5 + spec(version: VendorAPI::VERSION_1_5) + end + private def spec(**) diff --git a/spec/system/api_docs/api_docs_spec.rb b/spec/system/api_docs/api_docs_spec.rb index 31fc5873f52..94bedb12411 100644 --- a/spec/system/api_docs/api_docs_spec.rb +++ b/spec/system/api_docs/api_docs_spec.rb @@ -1,6 +1,6 @@ require 'rails_helper' -RSpec.feature 'API docs' do +RSpec.describe 'API docs' do scenario 'User browses through the API docs' do given_i_am_a_vendor i_can_browse_the_api_docs @@ -42,6 +42,6 @@ def when_i_enter_an_incorrect_api_version_in_the_url end def then_i_get_redirected_to_the_latest_production_version - expect(page).to have_current_path api_docs_versioned_reference_path(api_version: "v#{VendorAPI::VERSION}"), ignore_query: true + expect(page).to have_current_path api_docs_versioned_reference_path(api_version: "v#{AllowedCrossNamespaceUsage::VendorAPIInfo.released_version}"), ignore_query: true end end