# OpenAPI / Swagger Support

All Smile CDR FHIR Endpoint modules (FHIR Endpoint, FHIR Gateway, Hybrid Providers) support automatic generation of [OpenAPI](https://swagger.io/specification/) (aka Swagger) documentation. This documentation describes the FHIR operations, parameters, and request/response details supported by the API.

This support can be enabled and disabled by setting the [Enable OpenAPI / Swagger Support](/content/docs/configuration_categories/fhir_capability_statement.html#property-enable-openapi-swagger-support/index.html) setting on the appropriate FHIR Endpoint module.

With this setting enabled, you may wish to set the other [Capability Statement Settings](/content/docs/configuration_categories/fhir_capability_statement.html) as well, as these will control the information exported by the OpenAPI document.

# Swagger UI

One of the primary uses for OpenAPI documentation is to power the [Swagger UI](https://swagger.io/tools/swagger-ui/)
tool.

When OpenAPI support is enabled on a Smile CDR FHIR Endpoint, a customized version of Swagger UI will be automatically served by the FHIR Endpoint at: `[baseUrl]/swagger-ui/`, where `[baseUrl]` is the [Fixed Value for Endpoint Base](/content/docs/configuration_categories/fhir_rest_endpoint.html#base_url.fixed) URL property. To ensure the API Docs load correctly, this property must include any context paths in the URL e.g. `https://apis.example.org/fhir-request`

# OpenID Connect Support

If OpenID Connect authentication is enabled on a Smile CDR FHIR Endpoint, the Swagger UI will allow users to authenticate themselves through that protocol.

The following configuration parameters must be set to support the authentication process through Swagger:

- The `ANONYMOUS` user must be granted the `FHIR_CAPABILITIES` permission.
- For each [OpenID Connect Client](/content/docs/smart/client_management.html) that will access the Swagger UI, the list of
Authorized Redirect URLs must contain the value `[baseUrl]/swagger-ui/oauth2-redirect.html`.
- The SMART Outbound Security module must have Cross-Origin Resource Sharing (
CORS) [enabled](/content/docs/configuration_categories/cross_origin_resource_sharing_cors.html#cors.enable), and the list
of [CORS Allowed Request Headers](/content/docs/configuration_categories/cross_origin_resource_sharing_cors.html#cors.allowed_headers/index.html)
must include the value `x-requested-with`.

# Limitations

Smile CDR support for OpenAPI has the following known limitations:

- Complete schema definitions are not yet supplied for FHIR Resources.

[FHIRWeb Console](/content/docs/fhir_repository/fhirweb_console.html)

OpenAPI / Swagger Support

FHIR Storage

[FHIR Storage Modules](/content/docs/fhir_repository/fhir_storage_modules.html)
[FHIR Endpoint Module](/content/docs/fhir_repository/fhir_endpoint_module.html)
[FHIRWeb Console](/content/docs/fhir_repository/fhirweb_console.html)
[OpenAPI / Swagger Support](/content/docs/fhir_repository/openapi_swagger.html)
[FHIR Endpoint Customization](/content/docs/fhir_repository/fhir_endpoint_customization.html)
[Resource IDs](/content/docs/fhir_repository/resource_ids.html)
[Search Parameters](/content/docs/fhir_repository/search_parameters.html)
[Search Parameter Features](/content/docs/fhir_repository/search_parameter_features.html)
[Phonetic Search Parameters](/content/docs/fhir_repository/search_parameter_phonetic.html)
[Search Parameter Tuning](/content/docs/fhir_repository/search_parameter_tuning.html)
[Search Parameter Reindexing](/content/docs/fhir_repository/search_parameter_reindexing.html)
[Searching for Data](/content/docs/fhir_repository/searching_data.html)
[Creating Data](/content/docs/fhir_repository/creating_data.html)
[Reading Data](/content/docs/fhir_repository/reading_data.html)
[Updating Data](/content/docs/fhir_repository/updating_data.html)
[Deleting Data](/content/docs/fhir_repository/deleting_data.html)
[Binary Data](/content/docs/fhir_repository/binary_data.html)
[External Object Storage](/content/docs/fhir_repository/external_object_storage.html)
[Externalized Resource Body Storage](/content/docs/fhir_repository/externalized_resource_body_storage.html)
[Request Tracing and Provenance](/content/docs/fhir_repository/tracing_and_provenance.html)
[Resource Versions and Versioned References](/content/docs/fhir_repository/resource_versions_and_versioned_references.html)
[Tags, Profiles, and Security Labels](/content/docs/fhir_repository/tags_profiles_and_labels.html)
[Partitioning and Multitenancy](/content/docs/fhir_repository/partitioning.html)
[Patient ID Partitioning Modes](/content/docs/fhir_repository/patient_id_partitioning.html)
[Custom Resource Types](/content/docs/fhir_repository/custom_resource_types.html)
[Batch and Scheduled Jobs](/content/docs/fhir_repository/batch_and_scheduled_jobs.html)
[Tokenization](/content/docs/fhir_repository/tokenization.html)
[Bulk Resource Modification](/content/docs/fhir_repository/bulk_modification.html)

[FHIR Endpoint Customization](/content/docs/fhir_repository/fhir_endpoint_customization.html)
