Repository: sanic-org/sanic-ext (python)

Issue:
[Feature Request] If `API_SCHEMES` is defined in config and is not a list, try to convert it into one
**Is your feature request related to a problem? Please describe your use case.**
Currently the config value for `API_SCHEMES` is interpreted as-is but is used as an iterable, which makes it hard to use when it is defined using environment variables, as these are always strings.
https://github.com/sanic-org/sanic-ext/blob/993d9d7e92efe90909af90d521a664bf742c8035/sanic_ext/extensions/openapi/blueprint.py#L161 

**Describe the solution you'd like**
It would be nice if, in cases in which it is a string, it would split the string automatically (maybe in `,`) to convert it into a list.

**Additional context**
N/A.


Pull request description:
Add API_SCHEMES parsing
Closes #24 

Patch:
diff --git a/sanic_ext/extensions/openapi/blueprint.py b/sanic_ext/extensions/openapi/blueprint.py
index b02b749..612ab09 100644
--- a/sanic_ext/extensions/openapi/blueprint.py
+++ b/sanic_ext/extensions/openapi/blueprint.py
@@ -177,7 +177,10 @@ def add_static_info_to_spec_from_config(app, specification):
         getattr(app.config, "API_CONTACT_EMAIL", None),
     )
 
-    for scheme in getattr(app.config, "API_SCHEMES", ["http"]):
+    schemes = getattr(app.config, "API_SCHEMES", ["http"]) or ["http"]
+    if isinstance(schemes, str):
+        schemes = [s.strip() for s in schemes.split(",")]
+    for scheme in schemes:
         host = getattr(app.config, "API_HOST", None)
         basePath = getattr(app.config, "API_BASEPATH", "")
         if host is None or basePath is None:


Test patch:
diff --git a/tests/extensions/openapi/test_config.py b/tests/extensions/openapi/test_config.py
new file mode 100644
index 0000000..df47828
--- /dev/null
+++ b/tests/extensions/openapi/test_config.py
@@ -0,0 +1,34 @@
+import pytest
+
+from .utils import get_spec
+
+
+@pytest.mark.parametrize(
+    "schemes,expected",
+    (
+        (None, ("http://example.com/",)),
+        ("https", ("https://example.com/",)),
+        (
+            "http,https",
+            (
+                "http://example.com/",
+                "https://example.com/",
+            ),
+        ),
+        (
+            ["http", "https"],
+            (
+                "http://example.com/",
+                "https://example.com/",
+            ),
+        ),
+    ),
+)
+def test_config_scheme(app, schemes, expected):
+    app.config.API_SCHEMES = schemes
+    app.config.API_HOST = "example.com"
+
+    spec = get_spec(app)
+    urls = {s["url"] for s in spec["servers"]}
+
+    assert urls == set(expected)