Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions openapi/provider_data/v1/fixed.json
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,6 @@
"Datastore: query"
],
"summary": "Query one or more datastore resources",
"description": "Simple GET equivalent of a POST query. Note that parameters containing arrays or objects are not yet supported by SwaggerUI. For conditions, sorts, and other complex parameters, write your query in JSON and then convert to a nested query string. See [this web tool](https://www.convertonline.io/convert/json-to-query-string) for an example.",
"operationId": "datastore-query-get",
"parameters": [
{
Expand Down Expand Up @@ -329,7 +328,6 @@
"Datastore: query"
],
"summary": "Query one or more datastore resources for file download with get",
"description": "Simple GET equivalent of a POST query. Note that parameters containing arrays or objects are not yet supported by SwaggerUI. For conditions, sorts, and other complex parameters, write your query in JSON and then convert to a nested query string. See [this web tool](https://www.convertonline.io/convert/json-to-query-string) for an example.",
"operationId": "datastore-query-download-get",
"parameters": [
{
Expand Down Expand Up @@ -481,7 +479,6 @@
"Datastore: query"
],
"summary": "Query a single datastore resource with get",
"description": "Simple GET equivalent of a POST query. Note that parameters containing arrays or objects are not yet supported by SwaggerUI. For conditions, sorts, and other complex parameters, write your query in JSON and then convert to a nested query string. See [this web tool](https://www.convertonline.io/convert/json-to-query-string) for an example.",
"operationId": "datastore-resource-query-get",
"parameters": [
{
Expand Down Expand Up @@ -634,7 +631,6 @@
"Datastore: query"
],
"summary": "Query a single datastore resource with get",
"description": "Simple GET equivalent of a POST query -- see the POST endpoint documentation for full query schema. A few basic parameters are provided here as examples. For more reliable queries, write your query in JSON and then convert to a query string. See [this web tool](https://www.convertonline.io/convert/json-to-query-string) for an example.",
"operationId": "datastore-datasetindex-query-get",
"parameters": [
{
Expand Down Expand Up @@ -793,7 +789,6 @@
"Datastore: query"
],
"summary": "Query a single datastore resource for file download",
"description": "Like the other datastore query GET endpoints, additional parameters may be added by serializing a query JSON object (documented in the POST endpoints) into a query string.",
"operationId": "datastore-resource-query-download-get",
"parameters": [
{
Expand Down Expand Up @@ -889,7 +884,6 @@
"Datastore: query"
],
"summary": "Query a single datastore resource for file download",
"description": "Like the other datastore query GET endpoints, additional parameters may be added by serializing a query JSON object (documented in the POST endpoints) into a query string.",
"operationId": "datastore-datasetindex-query-download-get",
"parameters": [
{
Expand Down
22 changes: 20 additions & 2 deletions scripts/remodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,25 @@ def fix_provider_data_openapi(
get_datastore_query_dataset_id_index_download_parameters.append(
parameter
)
# Fix datastore/query descriptions to reflect above modifications
operation: oapi.oas.Operation
operation_pointer: str
for operation_pointer in (
"/paths/~1datastore~1query/get",
"/paths/~1datastore~1query~1download/get",
"/paths/~1datastore~1query~1{distributionId}/get",
"/paths/~1datastore~1query~1{distributionId}~1download/get",
"/paths/~1datastore~1query~1{datasetId}~1{index}/get",
"/paths/~1datastore~1query~1{datasetId}~1{index}~1download/get",
):
operation = jsonpointer.resolve_pointer(
openapi_document,
operation_pointer,
)
# If the description just indicates we should reference the POST
# operation, remove it.
if operation.description and ("POST" in operation.description):
Comment thread
davebelais marked this conversation as resolved.
operation.description = None
# Fix component parameters
parameters: oapi.oas.Parameters = cast(
oapi.oas.Parameters,
Expand Down Expand Up @@ -448,12 +467,11 @@ def update_client(name: str) -> None:
open_api=open_api,
model_path=model_py,
include_init_parameters=(
# TODO: Remove unused parameters from this tuple
"url",
"user",
"password",
# "bearer_token",
"api_key",
# "api_key",
# "api_key_in",
# "api_key_name",
# "oauth2_client_id",
Expand Down
35 changes: 6 additions & 29 deletions src/cmsgov/provider_data/v1/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ def __init__(
),
user: str | None = None,
password: str | None = None,
api_key: str | None = None,
timeout: int = 0,
retry_number_of_attempts: int = 3,
logger: Logger | None = None,
Expand All @@ -27,7 +26,6 @@ def __init__(
url: The base URL for API requests.
user: A user name for use with HTTP basic authentication.
password: A password for use with HTTP basic authentication.
api_key: An API key with which to authenticate requests.
timeout: The number of seconds before a request will timeout
and throw an error. If this is 0 (the default), the system
default timeout will be used.
Expand All @@ -43,7 +41,6 @@ def __init__(
url=url,
user=user,
password=password,
api_key=api_key,
timeout=timeout,
retry_number_of_attempts=retry_number_of_attempts,
logger=logger,
Expand Down Expand Up @@ -197,11 +194,7 @@ def get_datastore_query(
| str
):
"""
Simple GET equivalent of a POST query. Note that parameters containing
arrays or objects are not yet supported by SwaggerUI. For conditions,
sorts, and other complex parameters, write your query in JSON and then
convert to a nested query string. See [this web tool](https://www.
convertonline.io/convert/json-to-query-string) for an example.
Query one or more datastore resources

Parameters:
limit:
Expand Down Expand Up @@ -386,11 +379,7 @@ def get_datastore_query_download(
) = None,
) -> str:
"""
Simple GET equivalent of a POST query. Note that parameters containing
arrays or objects are not yet supported by SwaggerUI. For conditions,
sorts, and other complex parameters, write your query in JSON and then
convert to a nested query string. See [this web tool](https://www.
convertonline.io/convert/json-to-query-string) for an example.
Query one or more datastore resources for file download with get

Parameters:
limit:
Expand Down Expand Up @@ -574,11 +563,7 @@ def get_datastore_query_distribution_id(
| str
):
"""
Simple GET equivalent of a POST query. Note that parameters containing
arrays or objects are not yet supported by SwaggerUI. For conditions,
sorts, and other complex parameters, write your query in JSON and then
convert to a nested query string. See [this web tool](https://www.
convertonline.io/convert/json-to-query-string) for an example.
Query a single datastore resource with get

Parameters:
distribution_id: A distribution ID
Expand Down Expand Up @@ -788,11 +773,7 @@ def get_datastore_query_dataset_id_index(
| str
):
"""
Simple GET equivalent of a POST query -- see the POST endpoint
documentation for full query schema. A few basic parameters are
provided here as examples. For more reliable queries, write your query
in JSON and then convert to a query string. See [this web tool](https:/
/www.convertonline.io/convert/json-to-query-string) for an example.
Query a single datastore resource with get

Parameters:
dataset_id: A dataset ID
Expand Down Expand Up @@ -1010,9 +991,7 @@ def get_datastore_query_distribution_id_download(
) = None,
) -> str:
"""
Like the other datastore query GET endpoints, additional parameters may
be added by serializing a query JSON object (documented in the POST
endpoints) into a query string.
Query a single datastore resource for file download

Parameters:
distribution_id: A distribution ID
Expand Down Expand Up @@ -1122,9 +1101,7 @@ def get_datastore_query_dataset_id_index_download(
) = None,
) -> str:
"""
Like the other datastore query GET endpoints, additional parameters may
be added by serializing a query JSON object (documented in the POST
endpoints) into a query string.
Query a single datastore resource for file download

Parameters:
dataset_id: A dataset ID
Expand Down
6 changes: 1 addition & 5 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import os

import pytest
from dotenv import load_dotenv
Comment thread
davebelais marked this conversation as resolved.

Expand All @@ -10,6 +8,4 @@

@pytest.fixture(name="client", autouse=True, scope="session")
def get_provider_data_client() -> ProviderDataClient:
return ProviderDataClient(
api_key=os.environ.get("CMS_GOV_MARKETPLACE_API_KEY"), echo=True
)
return ProviderDataClient(echo=True)
Loading