Skip to content

Commit

Permalink
Api 26837/shared schema updates for appeals (#12961)
Browse files Browse the repository at this point in the history
* API-26837 Rename non_blank_string to nonBlankString in appeals

* API-26837 Add Content-Language header to appeals

This is suggested in Lighthouse standards
  • Loading branch information
caseywilliams authored Jun 13, 2023
1 parent f1d09a5 commit e67f8ec
Showing 28 changed files with 159 additions and 149 deletions.
Original file line number Diff line number Diff line change
@@ -5,6 +5,7 @@ class ApplicationController < ::ApplicationController
skip_before_action :verify_authenticity_token
skip_after_action :set_csrf_header
before_action :deactivate_endpoint
before_action :set_default_headers

def render_response(response)
render json: response.body, status: response.status
@@ -31,6 +32,12 @@ def sunset_date
nil
end

DEFAULT_HEADERS = { 'Content-Language' => 'en-US' }.freeze

def set_default_headers
DEFAULT_HEADERS.each { |k, v| response.headers[k] = v }
end

def set_tags_and_extra_context
RequestStore.store['additional_request_attributes'] = { 'source' => 'appeals_api' }
Raven.tags_context(source: 'appeals_api')
Original file line number Diff line number Diff line change
@@ -7,6 +7,7 @@ class MetadataController < ::ApplicationController
skip_before_action :verify_authenticity_token
skip_after_action :set_csrf_header
skip_before_action(:authenticate)
before_action :set_default_headers

def decision_reviews
render json: {
@@ -87,6 +88,10 @@ def decision_reviews_upstream_healthcheck

private

def set_default_headers
AppealsApi::ApplicationController::DEFAULT_HEADERS.each { |k, v| response.headers[k] = v }
end

def health_checker
@health_checker ||= AppealsApi::HealthChecker.new
end
Original file line number Diff line number Diff line change
@@ -8,7 +8,7 @@ class AppealsApi::Schemas::SharedSchemasController < AppealsApi::ApplicationCont

ACCEPTED_SCHEMA_TYPES = %w[
address
non_blank_string
nonBlankString
phone
timezone
].freeze
Original file line number Diff line number Diff line change
@@ -591,7 +591,7 @@
}
}
},
"non_blank_string": {
"nonBlankString": {
"type": "string",
"pattern": "[^ \\f\\n\\r\\t\\v\\u00a0\\u1680\\u2000-\\u200a\\u2028\\u2029\\u202f\\u205f\\u3000\\ufeff]"
},
@@ -604,7 +604,7 @@
"maxLength": 9
},
{
"$ref": "#/components/schemas/non_blank_string"
"$ref": "#/components/schemas/nonBlankString"
}
]
},
Original file line number Diff line number Diff line change
@@ -591,7 +591,7 @@
}
}
},
"non_blank_string": {
"nonBlankString": {
"type": "string",
"pattern": "[^ \\f\\n\\r\\t\\v\\u00a0\\u1680\\u2000-\\u200a\\u2028\\u2029\\u202f\\u205f\\u3000\\ufeff]"
},
@@ -604,7 +604,7 @@
"maxLength": 9
},
{
"$ref": "#/components/schemas/non_blank_string"
"$ref": "#/components/schemas/nonBlankString"
}
]
},
Original file line number Diff line number Diff line change
@@ -847,7 +847,7 @@
{
"name": "schema_type",
"in": "path",
"description": "Schema type. Can be: `200996`, `address`, `non_blank_string`, `phone`, `timezone`",
"description": "Schema type. Can be: `200996`, `address`, `nonBlankString`, `phone`, `timezone`",
"required": true,
"examples": {
"200996": {
@@ -856,8 +856,8 @@
"address": {
"value": "address"
},
"non_blank_string": {
"value": "non_blank_string"
"nonBlankString": {
"value": "nonBlankString"
},
"phone": {
"value": "phone"
@@ -1064,7 +1064,7 @@
"issue": {
"allOf": [
{
"$ref": "non_blank_string.json"
"$ref": "nonBlankString.json"
},
{
"minLength": 1,
@@ -1239,7 +1239,7 @@
}
}
},
"non_blank_string": {
"nonBlankString": {
"value": {
"$schema": "http://json-schema.org/draft-2020-12/schema#",
"description": "JSON Schema for VA Decision Review Forms: 'nonBlankString'",
@@ -2070,7 +2070,7 @@
"available_options": [
"200996",
"address",
"non_blank_string",
"nonBlankString",
"phone",
"timezone"
]
@@ -3042,7 +3042,7 @@
"issue": {
"allOf": [
{
"$ref": "#/components/schemas/non_blank_string"
"$ref": "#/components/schemas/nonBlankString"
},
{
"minLength": 1,
@@ -3147,7 +3147,7 @@
"data"
]
},
"non_blank_string": {
"nonBlankString": {
"type": "string",
"pattern": "[^ \\f\\n\\r\\t\\v\\u00a0\\u1680\\u2000-\\u200a\\u2028\\u2029\\u202f\\u205f\\u3000\\ufeff]"
},
@@ -3950,7 +3950,7 @@
"maxLength": 9
},
{
"$ref": "#/components/schemas/non_blank_string"
"$ref": "#/components/schemas/nonBlankString"
}
]
},
@@ -3978,7 +3978,7 @@
"maxLength": 18
},
{
"$ref": "#/components/schemas/non_blank_string"
"$ref": "#/components/schemas/nonBlankString"
}
]
},
@@ -3988,7 +3988,7 @@
"description": "last name"
},
{
"$ref": "#/components/schemas/non_blank_string"
"$ref": "#/components/schemas/nonBlankString"
}
]
},
@@ -3998,7 +3998,7 @@
"description": "middle initial"
},
{
"$ref": "#/components/schemas/non_blank_string"
"$ref": "#/components/schemas/nonBlankString"
}
]
},
@@ -4013,7 +4013,7 @@
"description": "first name"
},
{
"$ref": "#/components/schemas/non_blank_string"
"$ref": "#/components/schemas/nonBlankString"
}
]
},
@@ -4023,7 +4023,7 @@
"description": "last name"
},
{
"$ref": "#/components/schemas/non_blank_string"
"$ref": "#/components/schemas/nonBlankString"
}
]
},
@@ -4033,7 +4033,7 @@
"description": "middle initial"
},
{
"$ref": "#/components/schemas/non_blank_string"
"$ref": "#/components/schemas/nonBlankString"
}
]
},
Original file line number Diff line number Diff line change
@@ -847,7 +847,7 @@
{
"name": "schema_type",
"in": "path",
"description": "Schema type. Can be: `200996`, `address`, `non_blank_string`, `phone`, `timezone`",
"description": "Schema type. Can be: `200996`, `address`, `nonBlankString`, `phone`, `timezone`",
"required": true,
"examples": {
"200996": {
@@ -856,8 +856,8 @@
"address": {
"value": "address"
},
"non_blank_string": {
"value": "non_blank_string"
"nonBlankString": {
"value": "nonBlankString"
},
"phone": {
"value": "phone"
@@ -1064,7 +1064,7 @@
"issue": {
"allOf": [
{
"$ref": "non_blank_string.json"
"$ref": "nonBlankString.json"
},
{
"minLength": 1,
@@ -1239,7 +1239,7 @@
}
}
},
"non_blank_string": {
"nonBlankString": {
"value": {
"$schema": "http://json-schema.org/draft-2020-12/schema#",
"description": "JSON Schema for VA Decision Review Forms: 'nonBlankString'",
@@ -2070,7 +2070,7 @@
"available_options": [
"200996",
"address",
"non_blank_string",
"nonBlankString",
"phone",
"timezone"
]
@@ -3042,7 +3042,7 @@
"issue": {
"allOf": [
{
"$ref": "#/components/schemas/non_blank_string"
"$ref": "#/components/schemas/nonBlankString"
},
{
"minLength": 1,
@@ -3147,7 +3147,7 @@
"data"
]
},
"non_blank_string": {
"nonBlankString": {
"type": "string",
"pattern": "[^ \\f\\n\\r\\t\\v\\u00a0\\u1680\\u2000-\\u200a\\u2028\\u2029\\u202f\\u205f\\u3000\\ufeff]"
},
@@ -3950,7 +3950,7 @@
"maxLength": 9
},
{
"$ref": "#/components/schemas/non_blank_string"
"$ref": "#/components/schemas/nonBlankString"
}
]
},
@@ -3978,7 +3978,7 @@
"maxLength": 18
},
{
"$ref": "#/components/schemas/non_blank_string"
"$ref": "#/components/schemas/nonBlankString"
}
]
},
@@ -3988,7 +3988,7 @@
"description": "last name"
},
{
"$ref": "#/components/schemas/non_blank_string"
"$ref": "#/components/schemas/nonBlankString"
}
]
},
@@ -3998,7 +3998,7 @@
"description": "middle initial"
},
{
"$ref": "#/components/schemas/non_blank_string"
"$ref": "#/components/schemas/nonBlankString"
}
]
},
@@ -4013,7 +4013,7 @@
"description": "first name"
},
{
"$ref": "#/components/schemas/non_blank_string"
"$ref": "#/components/schemas/nonBlankString"
}
]
},
@@ -4023,7 +4023,7 @@
"description": "last name"
},
{
"$ref": "#/components/schemas/non_blank_string"
"$ref": "#/components/schemas/nonBlankString"
}
]
},
@@ -4033,7 +4033,7 @@
"description": "middle initial"
},
{
"$ref": "#/components/schemas/non_blank_string"
"$ref": "#/components/schemas/nonBlankString"
}
]
},
Original file line number Diff line number Diff line change
@@ -521,7 +521,7 @@
}
}
},
"non_blank_string": {
"nonBlankString": {
"type": "string",
"pattern": "[^ \\f\\n\\r\\t\\v\\u00a0\\u1680\\u2000-\\u200a\\u2028\\u2029\\u202f\\u205f\\u3000\\ufeff]"
},
@@ -534,7 +534,7 @@
"maxLength": 9
},
{
"$ref": "#/components/schemas/non_blank_string"
"$ref": "#/components/schemas/nonBlankString"
}
]
},
Original file line number Diff line number Diff line change
@@ -521,7 +521,7 @@
}
}
},
"non_blank_string": {
"nonBlankString": {
"type": "string",
"pattern": "[^ \\f\\n\\r\\t\\v\\u00a0\\u1680\\u2000-\\u200a\\u2028\\u2029\\u202f\\u205f\\u3000\\ufeff]"
},
@@ -534,7 +534,7 @@
"maxLength": 9
},
{
"$ref": "#/components/schemas/non_blank_string"
"$ref": "#/components/schemas/nonBlankString"
}
]
},
Loading

0 comments on commit e67f8ec

Please sign in to comment.