Skip to content

Commit

Permalink
Add 404 to rswag, add generated swagger
Browse files Browse the repository at this point in the history
  • Loading branch information
mchristiansonVA committed Apr 26, 2024
1 parent 48f16b3 commit 37b196a
Show file tree
Hide file tree
Showing 2 changed files with 97 additions and 7 deletions.
75 changes: 68 additions & 7 deletions modules/claims_api/app/swagger/claims_api/v2/dev/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -6072,7 +6072,7 @@
"application/json": {
"example": {
"data": {
"id": "6be9b240-267c-4c9c-b8d5-af1cd4068308",
"id": "85570baa-5023-485d-9616-014117c7f9c3",
"type": "forms/526",
"attributes": {
"veteran": {
Expand Down Expand Up @@ -8156,8 +8156,8 @@
"id": "1",
"type": "intent_to_file",
"attributes": {
"creationDate": "2024-04-24",
"expirationDate": "2025-04-24",
"creationDate": "2024-04-26",
"expirationDate": "2025-04-26",
"type": "compensation",
"status": "active"
}
Expand Down Expand Up @@ -8865,6 +8865,67 @@
}
}
},
"404": {
"description": "Resource not found",
"content": {
"application/json": {
"example": {
"errors": [
{
"title": "Resource not found",
"status": "404",
"detail": "Resource not found",
"source": {
"pointer": "/Users/matthewchristianson/.rbenv/versions/3.2.3/lib/ruby/gems/3.2.0/gems/rspec-mocks-3.13.0/lib/rspec/mocks/message_expectation.rb:188:in `block in and_raise'"
}
}
]
},
"schema": {
"required": [
"errors"
],
"properties": {
"errors": {
"type": "array",
"items": {
"additionalProperties": false,
"required": [
"title",
"detail"
],
"properties": {
"title": {
"type": "string",
"description": "HTTP error title"
},
"detail": {
"type": "string",
"description": "HTTP error detail"
},
"status": {
"type": "string",
"description": "HTTP error status code"
},
"source": {
"type": "object",
"additionalProperties": false,
"description": "Source of error",
"properties": {
"pointer": {
"type": "string",
"description": "Pointer to source of error"
}
}
}
}
}
}
}
}
}
}
},
"422": {
"description": "Unprocessable Entity",
"content": {
Expand Down Expand Up @@ -8975,7 +9036,7 @@
"application/json": {
"example": {
"data": {
"id": "867b7baa-8dbe-4053-823f-788218fa6984",
"id": "7d13ac13-edf3-45e9-b5d4-5efece079c5b",
"type": "individual",
"attributes": {
"code": "083",
Expand Down Expand Up @@ -9671,7 +9732,7 @@
"application/json": {
"example": {
"data": {
"id": "c54cfb3e-8ec8-48ce-bb19-52847bdd9bde",
"id": "4fa4f1ba-56e1-42da-990d-33b05503a01d",
"type": "organization",
"attributes": {
"code": "083",
Expand Down Expand Up @@ -11631,11 +11692,11 @@
"application/json": {
"example": {
"data": {
"id": "af367b07-5484-4eb7-8a2b-3d4bf1ba447c",
"id": "d8d4b85e-53d1-490e-baee-22903dcf3661",
"type": "claimsApiPowerOfAttorneys",
"attributes": {
"status": "submitted",
"dateRequestAccepted": "2024-04-24",
"dateRequestAccepted": "2024-04-26",
"representative": {
"serviceOrganization": {
"poaCode": "074"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,35 @@
end
end

describe 'Getting a 404 response' do
response '404', 'Resource not found' do
schema JSON.parse(Rails.root.join('spec', 'support', 'schemas', 'claims_api', 'v2', 'errors',
'power_of_attorney', 'default.json').read)

let(:veteranId) { 'xxx' } # rubocop:disable RSpec/VariableName

before do |example|
allow_any_instance_of(ClaimsApi::V2::Veterans::PowerOfAttorney::BaseController).to receive(:show)
.and_raise(Common::Exceptions::ResourceNotFound)
mock_ccg(scopes) do
submit_request(example.metadata)
end
end

after do |example|
example.metadata[:response][:content] = {
'application/json' => {
example: JSON.parse(response.body, symbolize_names: true)
}
}
end

it 'returns a 404 response' do |example|
assert_response_matches_metadata(example.metadata)
end
end
end

describe 'Getting a 422 response' do
response '422', 'Unprocessable Entity' do
schema JSON.parse(File.read(Rails.root.join('spec', 'support', 'schemas', 'claims_api', 'v2', 'errors',
Expand Down

0 comments on commit 37b196a

Please sign in to comment.