From 542361260b258eb275339dedc15e29fb02a3d30b Mon Sep 17 00:00:00 2001 From: Josh Fike Date: Tue, 26 Nov 2024 15:08:28 -0600 Subject: [PATCH] Provide example string error, correct content type --- .../representation_management/app/swagger/v0/swagger.json | 7 ++++--- .../v0/pdf_generator_2122_swagger_spec.rb | 3 ++- .../v0/pdf_generator_2122a_swagger_spec.rb | 3 ++- .../representation_management/spec/support/rswag_config.rb | 3 ++- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/modules/representation_management/app/swagger/v0/swagger.json b/modules/representation_management/app/swagger/v0/swagger.json index 8c9262e394e..fedfdc0365e 100644 --- a/modules/representation_management/app/swagger/v0/swagger.json +++ b/modules/representation_management/app/swagger/v0/swagger.json @@ -84,7 +84,8 @@ } }, "Error": { - "type": "string" + "type": "string", + "example": "Veteran first name can't be blank" }, "PowerOfAttorneyResponse": { "type": "object", @@ -210,7 +211,7 @@ "422": { "description": "unprocessable entity response", "content": { - "application/pdf": { + "application/json": { "schema": { "$ref": "#/components/schemas/Errors" } @@ -443,7 +444,7 @@ "422": { "description": "unprocessable entity response", "content": { - "application/pdf": { + "application/json": { "schema": { "$ref": "#/components/schemas/Errors" } diff --git a/modules/representation_management/spec/requests/representation_management/v0/pdf_generator_2122_swagger_spec.rb b/modules/representation_management/spec/requests/representation_management/v0/pdf_generator_2122_swagger_spec.rb index b11fbb7f247..f0517363b61 100644 --- a/modules/representation_management/spec/requests/representation_management/v0/pdf_generator_2122_swagger_spec.rb +++ b/modules/representation_management/spec/requests/representation_management/v0/pdf_generator_2122_swagger_spec.rb @@ -18,12 +18,12 @@ post('Generate a PDF for form 21-22') do tags 'PDF Generation' consumes 'application/json' - produces 'application/pdf' operationId 'createPdfForm2122' parameter SwaggerSharedComponents::V0.body_examples[:pdf_generator2122_parameter] response '200', 'PDF generated successfully' do + produces 'application/pdf' let(:pdf_generator2122) do SwaggerSharedComponents::V0.body_examples[:pdf_generator2122] end @@ -31,6 +31,7 @@ end response '422', 'unprocessable entity response' do + produces 'application/json' let(:pdf_generator2122) do params = SwaggerSharedComponents::V0.body_examples[:pdf_generator2122] params[:veteran][:name].delete(:first) diff --git a/modules/representation_management/spec/requests/representation_management/v0/pdf_generator_2122a_swagger_spec.rb b/modules/representation_management/spec/requests/representation_management/v0/pdf_generator_2122a_swagger_spec.rb index be0809afde2..6f7a70e9dd7 100644 --- a/modules/representation_management/spec/requests/representation_management/v0/pdf_generator_2122a_swagger_spec.rb +++ b/modules/representation_management/spec/requests/representation_management/v0/pdf_generator_2122a_swagger_spec.rb @@ -15,12 +15,12 @@ post('Generate a PDF for form 21-22a') do tags 'PDF Generation' consumes 'application/json' - produces 'application/pdf' operationId 'createPdfForm2122a' parameter SwaggerSharedComponents::V0.body_examples[:pdf_generator2122a_parameter] response '200', 'PDF generated successfully' do + produces 'application/pdf' let(:pdf_generator2122a) do SwaggerSharedComponents::V0.body_examples[:pdf_generator2122a] end @@ -28,6 +28,7 @@ end response '422', 'unprocessable entity response' do + produces 'application/json' let(:pdf_generator2122a) do params = SwaggerSharedComponents::V0.body_examples[:pdf_generator2122a] params[:veteran][:name].delete(:first) diff --git a/modules/representation_management/spec/support/rswag_config.rb b/modules/representation_management/spec/support/rswag_config.rb index 199a58d88c5..4c5a93d9107 100644 --- a/modules/representation_management/spec/support/rswag_config.rb +++ b/modules/representation_management/spec/support/rswag_config.rb @@ -98,7 +98,8 @@ def errors def error { - type: :string + type: :string, + example: "Veteran first name can't be blank" } end