Skip to content

Commit e056a98

Browse files
committed
[NRL-1658] Move /metadata endpoint into swagger OAS
1 parent 918301b commit e056a98

File tree

6 files changed

+56
-63
lines changed

6 files changed

+56
-63
lines changed

api/consumer/swagger.yaml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -382,6 +382,29 @@ paths:
382382
description: |
383383
Read a single document pointer by specifying the `DocumentReference.id`. Note that you will only be able to
384384
retrieve document pointers that have the `type` that was agreed during the [onboarding](#api-description__onboarding) process.
385+
386+
/metadata:
387+
get:
388+
summary: Retrieve FHIR Capability Statement
389+
operationId: getCapabilityStatement
390+
responses:
391+
"200":
392+
description: Capability statement response
393+
content:
394+
application/json:
395+
schema:
396+
type: object
397+
x-amazon-apigateway-integration:
398+
type: MOCK
399+
requestTemplates:
400+
application/json: '{ "statusCode": 200 }'
401+
responses:
402+
default:
403+
statusCode: "200"
404+
responseTemplates:
405+
# prettier-ignore
406+
application/json: '${capability_statement_json}'
407+
385408
/_status:
386409
get:
387410
tags:

api/producer/swagger.yaml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -915,6 +915,29 @@ paths:
915915
contentHandling: CONVERT_TO_TEXT
916916
description: |
917917
Delete a single document pointer that your created.
918+
919+
/metadata:
920+
get:
921+
summary: Retrieve FHIR Capability Statement
922+
operationId: getCapabilityStatement
923+
responses:
924+
"200":
925+
description: Capability statement response
926+
content:
927+
application/json:
928+
schema:
929+
type: object
930+
x-amazon-apigateway-integration:
931+
type: MOCK
932+
requestTemplates:
933+
application/json: '{ "statusCode": 200 }'
934+
responses:
935+
default:
936+
statusCode: "200"
937+
responseTemplates:
938+
# prettier-ignore
939+
application/json: '${capability_statement_json}'
940+
918941
/_status:
919942
get:
920943
summary: _status endpoint for APIGEE integration

terraform/infrastructure/consumer.tftpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
}
5959
],
6060
"versioning": "version",
61-
"readHistory": false,
61+
"readHistory": false
6262
},
6363
{
6464
"type": "DocumentReference",

terraform/infrastructure/modules/api_gateway/api_gateway.tf

Lines changed: 6 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -2,50 +2,12 @@ resource "aws_api_gateway_rest_api" "api_gateway_rest_api" {
22
name = "${var.prefix}--${var.apitype}"
33
description = "Manages an API Gateway Rest API."
44
disable_execute_api_endpoint = true
5-
body = templatefile("${path.module}/../../../../api/${var.apitype}/swagger.yaml", var.lambdas)
6-
}
7-
8-
resource "aws_api_gateway_resource" "capability" {
9-
rest_api_id = aws_api_gateway_rest_api.api_gateway_rest_api.id
10-
parent_id = aws_api_gateway_rest_api.api_gateway_rest_api.root_resource_id
11-
path_part = "metadata"
12-
}
13-
14-
resource "aws_api_gateway_method" "capability" {
15-
rest_api_id = aws_api_gateway_rest_api.api_gateway_rest_api.id
16-
resource_id = aws_api_gateway_resource.capability.id
17-
http_method = "GET"
18-
authorization = "NONE"
19-
20-
depends_on = [aws_api_gateway_resource.capability]
21-
}
22-
23-
resource "aws_api_gateway_integration" "capability" {
24-
rest_api_id = aws_api_gateway_rest_api.api_gateway_rest_api.id
25-
resource_id = aws_api_gateway_resource.capability.id
26-
http_method = aws_api_gateway_method.capability.http_method
27-
type = "MOCK"
28-
request_templates = {
29-
"application/json" = jsonencode({ "statusCode" = 200 })
30-
}
31-
}
32-
33-
resource "aws_api_gateway_method_response" "capability_200" {
34-
rest_api_id = aws_api_gateway_rest_api.api_gateway_rest_api.id
35-
resource_id = aws_api_gateway_resource.capability.id
36-
http_method = aws_api_gateway_method.capability.http_method
37-
status_code = "200"
38-
}
39-
40-
resource "aws_api_gateway_integration_response" "capability" {
41-
rest_api_id = aws_api_gateway_rest_api.api_gateway_rest_api.id
42-
resource_id = aws_api_gateway_resource.capability.id
43-
http_method = aws_api_gateway_method.capability.http_method
44-
status_code = aws_api_gateway_method_response.capability_200.status_code
45-
46-
response_templates = {
47-
"application/json" = var.capability_statement_content
48-
}
5+
body = templatefile(
6+
"${path.module}/../../../../api/${var.apitype}/swagger.yaml",
7+
merge(var.lambdas, {
8+
capability_statement_json = var.capability_statement_content
9+
})
10+
)
4911
}
5012

5113
resource "aws_api_gateway_deployment" "api_gateway_deployment" {
@@ -65,11 +27,6 @@ resource "aws_api_gateway_deployment" "api_gateway_deployment" {
6527

6628
depends_on = [
6729
aws_api_gateway_rest_api.api_gateway_rest_api,
68-
aws_api_gateway_resource.capability,
69-
aws_api_gateway_method.capability,
70-
aws_api_gateway_integration.capability,
71-
aws_api_gateway_method_response.capability_200,
72-
aws_api_gateway_integration_response.capability,
7330
aws_api_gateway_integration_response.head_integration_response
7431
]
7532
}

terraform/infrastructure/producer.tftpl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@
2323
"description": "Capability Statement for the National Record Locator FHIR R4 Producer API",
2424
"kind": "instance",
2525
"software": {
26-
"name": "National Record Locator FHIR R4 API - Producer"
26+
"name": "National Record Locator FHIR R4 API - Producer",
27+
"version": "v3.0"
2728
},
2829
"implementation": {
2930
"description": "NRL v3.0 Producer API FHIR Server",
@@ -57,7 +58,7 @@
5758
}
5859
],
5960
"versioning": "version",
60-
"readHistory": false,
61+
"readHistory": false
6162
},
6263
{
6364
"type": "DocumentReference",

tests/smoke/scenarios/api_capability_statement_lookup.py

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,6 @@
1-
import os
2-
3-
import pytest
4-
51
from tests.utilities.api_clients import ConsumerTestClient, ProducerTestClient
62

73

8-
def is_public_url():
9-
return os.environ.get("TEST_CONNECT_MODE") == "public"
10-
11-
12-
@pytest.mark.skip(
13-
reason="Capability statements only work via APIGEE in persistent environments",
14-
)
154
def test_read_api_capability_statements(
165
consumer_client: ConsumerTestClient, producer_client: ProducerTestClient
176
):

0 commit comments

Comments
 (0)