From 88dfea6b658d8bff2144e3d3bf09d41df1fd5a95 Mon Sep 17 00:00:00 2001 From: TheByronHimes Date: Wed, 25 Oct 2023 11:53:43 +0000 Subject: [PATCH] Update the updatables --- README.md | 78 ++++++++++++++++++-- config_schema.json | 174 ++++++++++++++++++++++----------------------- openapi.yaml | 2 +- 3 files changed, 158 insertions(+), 96 deletions(-) diff --git a/README.md b/README.md index 2aaa83cc..0bc12665 100644 --- a/README.md +++ b/README.md @@ -88,19 +88,83 @@ The service requires the following configuration parameters: - **`docs_url`** *(string)*: Path to host the swagger documentation. This is relative to the specified host and port. Default: `"/docs"`. -- **`cors_allowed_origins`** *(array)*: A list of origins that should be permitted to make cross-origin requests. By default, cross-origin requests are not allowed. You can use ['*'] to allow any origin. +- **`cors_allowed_origins`**: A list of origins that should be permitted to make cross-origin requests. By default, cross-origin requests are not allowed. You can use ['*'] to allow any origin. Default: `null`. - - **Items** *(string)* + - **Any of** -- **`cors_allow_credentials`** *(boolean)*: Indicate that cookies should be supported for cross-origin requests. Defaults to False. Also, cors_allowed_origins cannot be set to ['*'] for credentials to be allowed. The origins must be explicitly specified. + - *array* -- **`cors_allowed_methods`** *(array)*: A list of HTTP methods that should be allowed for cross-origin requests. Defaults to ['GET']. You can use ['*'] to allow all standard methods. + - **Items** *(string)* - - **Items** *(string)* + - *null* -- **`cors_allowed_headers`** *(array)*: A list of HTTP request headers that should be supported for cross-origin requests. Defaults to []. You can use ['*'] to allow all headers. The Accept, Accept-Language, Content-Language and Content-Type headers are always allowed for CORS requests. - - **Items** *(string)* + Examples: + + ```json + [ + "https://example.org", + "https://www.example.org" + ] + ``` + + +- **`cors_allow_credentials`**: Indicate that cookies should be supported for cross-origin requests. Defaults to False. Also, cors_allowed_origins cannot be set to ['*'] for credentials to be allowed. The origins must be explicitly specified. Default: `null`. + + - **Any of** + + - *boolean* + + - *null* + + + Examples: + + ```json + [ + "https://example.org", + "https://www.example.org" + ] + ``` + + +- **`cors_allowed_methods`**: A list of HTTP methods that should be allowed for cross-origin requests. Defaults to ['GET']. You can use ['*'] to allow all standard methods. Default: `null`. + + - **Any of** + + - *array* + + - **Items** *(string)* + + - *null* + + + Examples: + + ```json + [ + "*" + ] + ``` + + +- **`cors_allowed_headers`**: A list of HTTP request headers that should be supported for cross-origin requests. Defaults to []. You can use ['*'] to allow all headers. The Accept, Accept-Language, Content-Language and Content-Type headers are always allowed for CORS requests. Default: `null`. + + - **Any of** + + - *array* + + - **Items** *(string)* + + - *null* + + + Examples: + + ```json + [] + ``` + - **`service_name`** *(string)*: Default: `"my_microservice"`. diff --git a/config_schema.json b/config_schema.json index 0e2d0c1c..58799554 100644 --- a/config_schema.json +++ b/config_schema.json @@ -1,33 +1,22 @@ { - "title": "ModSettings", + "additionalProperties": false, "description": "Modifies the orginal Settings class provided by the user", - "type": "object", "properties": { "host": { - "title": "Host", - "description": "IP of the host.", "default": "127.0.0.1", - "env_names": [ - "my_microservice_host" - ], + "description": "IP of the host.", + "title": "Host", "type": "string" }, "port": { - "title": "Port", - "description": "Port to expose the server on the specified host", "default": 8080, - "env_names": [ - "my_microservice_port" - ], + "description": "Port to expose the server on the specified host", + "title": "Port", "type": "integer" }, "log_level": { - "title": "Log Level", - "description": "Controls the verbosity of the log.", "default": "info", - "env_names": [ - "my_microservice_log_level" - ], + "description": "Controls the verbosity of the log.", "enum": [ "critical", "error", @@ -36,128 +25,137 @@ "debug", "trace" ], + "title": "Log Level", "type": "string" }, "auto_reload": { - "title": "Auto Reload", - "description": "A development feature. Set to `True` to automatically reload the server upon code changes", "default": false, - "env_names": [ - "my_microservice_auto_reload" - ], + "description": "A development feature. Set to `True` to automatically reload the server upon code changes", + "title": "Auto Reload", "type": "boolean" }, "workers": { - "title": "Workers", - "description": "Number of workers processes to run.", "default": 1, - "env_names": [ - "my_microservice_workers" - ], + "description": "Number of workers processes to run.", + "title": "Workers", "type": "integer" }, "api_root_path": { - "title": "Api Root Path", - "description": "Root path at which the API is reachable. This is relative to the specified host and port.", "default": "/", - "env_names": [ - "my_microservice_api_root_path" - ], + "description": "Root path at which the API is reachable. This is relative to the specified host and port.", + "title": "Api Root Path", "type": "string" }, "openapi_url": { - "title": "Openapi Url", - "description": "Path to get the openapi specification in JSON format. This is relative to the specified host and port.", "default": "/openapi.json", - "env_names": [ - "my_microservice_openapi_url" - ], + "description": "Path to get the openapi specification in JSON format. This is relative to the specified host and port.", + "title": "Openapi Url", "type": "string" }, "docs_url": { - "title": "Docs Url", - "description": "Path to host the swagger documentation. This is relative to the specified host and port.", "default": "/docs", - "env_names": [ - "my_microservice_docs_url" - ], + "description": "Path to host the swagger documentation. This is relative to the specified host and port.", + "title": "Docs Url", "type": "string" }, "cors_allowed_origins": { - "title": "Cors Allowed Origins", + "anyOf": [ + { + "items": { + "type": "string" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "default": null, "description": "A list of origins that should be permitted to make cross-origin requests. By default, cross-origin requests are not allowed. You can use ['*'] to allow any origin.", - "example": [ - "https://example.org", - "https://www.example.org" + "examples": [ + [ + "https://example.org", + "https://www.example.org" + ] ], - "env_names": [ - "my_microservice_cors_allowed_origins" - ], - "type": "array", - "items": { - "type": "string" - } + "title": "Cors Allowed Origins" }, "cors_allow_credentials": { - "title": "Cors Allow Credentials", + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "null" + } + ], + "default": null, "description": "Indicate that cookies should be supported for cross-origin requests. Defaults to False. Also, cors_allowed_origins cannot be set to ['*'] for credentials to be allowed. The origins must be explicitly specified.", - "example": [ - "https://example.org", - "https://www.example.org" - ], - "env_names": [ - "my_microservice_cors_allow_credentials" + "examples": [ + [ + "https://example.org", + "https://www.example.org" + ] ], - "type": "boolean" + "title": "Cors Allow Credentials" }, "cors_allowed_methods": { - "title": "Cors Allowed Methods", + "anyOf": [ + { + "items": { + "type": "string" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "default": null, "description": "A list of HTTP methods that should be allowed for cross-origin requests. Defaults to ['GET']. You can use ['*'] to allow all standard methods.", - "example": [ - "*" - ], - "env_names": [ - "my_microservice_cors_allowed_methods" + "examples": [ + [ + "*" + ] ], - "type": "array", - "items": { - "type": "string" - } + "title": "Cors Allowed Methods" }, "cors_allowed_headers": { - "title": "Cors Allowed Headers", + "anyOf": [ + { + "items": { + "type": "string" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "default": null, "description": "A list of HTTP request headers that should be supported for cross-origin requests. Defaults to []. You can use ['*'] to allow all headers. The Accept, Accept-Language, Content-Language and Content-Type headers are always allowed for CORS requests.", - "example": [], - "env_names": [ - "my_microservice_cors_allowed_headers" + "examples": [ + [] ], - "type": "array", - "items": { - "type": "string" - } + "title": "Cors Allowed Headers" }, "service_name": { - "title": "Service Name", "default": "my_microservice", - "env_names": [ - "my_microservice_service_name" - ], + "title": "Service Name", "type": "string" }, "language": { - "title": "Language", "default": "Croatian", - "env_names": [ - "my_microservice_language" - ], "enum": [ "Greek", "Croatian", "French", "German" ], + "title": "Language", "type": "string" } }, - "additionalProperties": false + "title": "ModSettings", + "type": "object" } \ No newline at end of file diff --git a/openapi.yaml b/openapi.yaml index fbdfe9d1..ab018dba 100644 --- a/openapi.yaml +++ b/openapi.yaml @@ -65,7 +65,7 @@ components: info: title: FastAPI version: 0.1.0 -openapi: 3.0.2 +openapi: 3.1.0 paths: /: get: