diff --git a/openapi/provider_data/v1/fixed.json b/openapi/provider_data/v1/fixed.json index 2046a83..875bf37 100644 --- a/openapi/provider_data/v1/fixed.json +++ b/openapi/provider_data/v1/fixed.json @@ -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": [ { @@ -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": [ { @@ -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": [ { @@ -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": [ { @@ -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": [ { @@ -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": [ { diff --git a/scripts/remodel.py b/scripts/remodel.py index ceeeb98..53106c9 100644 --- a/scripts/remodel.py +++ b/scripts/remodel.py @@ -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): + operation.description = None # Fix component parameters parameters: oapi.oas.Parameters = cast( oapi.oas.Parameters, @@ -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", diff --git a/src/cmsgov/provider_data/v1/client.py b/src/cmsgov/provider_data/v1/client.py index ed5d34e..95d7583 100644 --- a/src/cmsgov/provider_data/v1/client.py +++ b/src/cmsgov/provider_data/v1/client.py @@ -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, @@ -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. @@ -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, @@ -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: @@ -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: @@ -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 @@ -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 @@ -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 @@ -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 diff --git a/tests/conftest.py b/tests/conftest.py index cc3899e..48b8047 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,5 +1,3 @@ -import os - import pytest from dotenv import load_dotenv @@ -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)