diff --git a/CHANGELOG.md b/CHANGELOG.md index 5bd5672..fd4f082 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,13 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [1.3.1] - 2026-03-?? + +- Add OAS 3.1 support, cross-version warnings, and fix nullable spacing, by @dcode. +- Fix MARKDOWN style table separators to use minimum 3 hyphens (issue #39), reported by @michael-nok. + ## [1.3.0] - 2025-11-19 + - Add support for passing custom Jinja2 templates as an argument, by @sindrehan. ## [1.2.1] - 2025-07-30 diff --git a/openapidocs/__init__.py b/openapidocs/__init__.py index aebce15..ce3e94f 100644 --- a/openapidocs/__init__.py +++ b/openapidocs/__init__.py @@ -1,2 +1,2 @@ -__version__ = "1.3.0" +__version__ = "1.3.1" VERSION = __version__ diff --git a/openapidocs/mk/md.py b/openapidocs/mk/md.py index 19c0670..a3128dd 100644 --- a/openapidocs/mk/md.py +++ b/openapidocs/mk/md.py @@ -49,7 +49,7 @@ def write_table_lines( if write_headers: # add separator line after headers yield write_row( - ["-" * column_len for column_len in columns_widths.values()], + ["-" * max(3, column_len) for column_len in columns_widths.values()], columns_widths, padding, indent, diff --git a/openapidocs/mk/v3/views_markdown/partial/type.html b/openapidocs/mk/v3/views_markdown/partial/type.html index 01b5432..108c719 100644 --- a/openapidocs/mk/v3/views_markdown/partial/type.html +++ b/openapidocs/mk/v3/views_markdown/partial/type.html @@ -2,7 +2,7 @@ {%- with props = handler.get_properties(definition) -%} {% if props %} | {{texts.name}} | {{texts.type}} | -| -- | -- | +| --- | --- | {%- for name, schema in props %} | {{name}} | {% include "partial/schema-repr.html" %} | {%- endfor -%} diff --git a/tests/res/example1-output-plain.md b/tests/res/example1-output-plain.md index ea2985a..5abee8f 100644 --- a/tests/res/example1-output-plain.md +++ b/tests/res/example1-output-plain.md @@ -2954,7 +2954,7 @@ _Other possible types: text/json, text/plain_ ### Category | Name | Type | -| -- | -- | +| --- | --- | | creationTime | string(date-time) | | description | string | null | | eTag | string | @@ -2968,7 +2968,7 @@ _Other possible types: text/json, text/plain_ ### Country | Name | Type | -| -- | -- | +| --- | --- | | countryCode | string | null | | id | string | null | | name | string | @@ -2978,7 +2978,7 @@ _Other possible types: text/json, text/plain_ ### CreateOrganizationsBoundInput | Name | Type | -| -- | -- | +| --- | --- | | items | Array<[OrganizationBoundInput](#organizationboundinput)> | @@ -2986,7 +2986,7 @@ _Other possible types: text/json, text/plain_ ### CreateReleaseInput | Name | Type | -| -- | -- | +| --- | --- | | categoryId | string | | countries | Array<string> | | description | string | null | @@ -2997,7 +2997,7 @@ _Other possible types: text/json, text/plain_ ### CreateReleaseNodeInput | Name | Type | -| -- | -- | +| --- | --- | | fileId | string(uuid) | | fileName | string | | fileSize | integer(int32) | @@ -3008,7 +3008,7 @@ _Other possible types: text/json, text/plain_ ### CreateReleaseOutput | Name | Type | -| -- | -- | +| --- | --- | | id | string(uuid) | @@ -3016,7 +3016,7 @@ _Other possible types: text/json, text/plain_ ### CurrentRelease | Name | Type | -| -- | -- | +| --- | --- | | categoryId | string | null | | countryCode | string | null | | countryName | string | null | @@ -3029,7 +3029,7 @@ _Other possible types: text/json, text/plain_ ### DeleteReleaseNodeInput | Name | Type | -| -- | -- | +| --- | --- | | id | string(uuid) | @@ -3037,7 +3037,7 @@ _Other possible types: text/json, text/plain_ ### FileDownloadStats | Name | Type | -| -- | -- | +| --- | --- | | uniqueDownloads | integer(int32) | @@ -3045,7 +3045,7 @@ _Other possible types: text/json, text/plain_ ### FileUrl | Name | Type | -| -- | -- | +| --- | --- | | url | string | null | @@ -3053,7 +3053,7 @@ _Other possible types: text/json, text/plain_ ### GenericError | Name | Type | -| -- | -- | +| --- | --- | | code | integer(int32) | | message | string | @@ -3062,7 +3062,7 @@ _Other possible types: text/json, text/plain_ ### HealthCheck | Name | Type | -| -- | -- | +| --- | --- | | alive | boolean | | regionName | string | null | | timestamp | string(date-time) | @@ -3072,7 +3072,7 @@ _Other possible types: text/json, text/plain_ ### InitializeUploadInput | Name | Type | -| -- | -- | +| --- | --- | | fileName | string | null | | fileSize | integer(int32) | | fileType | string | null | @@ -3083,7 +3083,7 @@ _Other possible types: text/json, text/plain_ ### InitializeUploadOutput | Name | Type | -| -- | -- | +| --- | --- | | baseURL | string | null | | fileId | string | null | | fileName | string | null | @@ -3094,7 +3094,7 @@ _Other possible types: text/json, text/plain_ ### MetaData | Name | Type | -| -- | -- | +| --- | --- | | buildNumber | string | null | | contactEmail | string | null | | version | string | null | @@ -3104,7 +3104,7 @@ _Other possible types: text/json, text/plain_ ### NodeInfo | Name | Type | -| -- | -- | +| --- | --- | | creationTime | string(date-time) | | eTag | string | | extension | string | @@ -3120,7 +3120,7 @@ _Other possible types: text/json, text/plain_ ### OrganizationBoundInput | Name | Type | -| -- | -- | +| --- | --- | | id | string(uuid) | | name | string | null | @@ -3129,7 +3129,7 @@ _Other possible types: text/json, text/plain_ ### ProfessionalContext | Name | Type | -| -- | -- | +| --- | --- | | membership | Array<[ProfessionalMembership](#professionalmembership)> | | signature | string | null | @@ -3138,7 +3138,7 @@ _Other possible types: text/json, text/plain_ ### ProfessionalMembership | Name | Type | -| -- | -- | +| --- | --- | | brandNames | Array<string> | | categoryId | string | null | | id | string(uuid) | @@ -3156,7 +3156,7 @@ _Other possible types: text/json, text/plain_ ### PublishReleaseInput | Name | Type | -| -- | -- | +| --- | --- | | eTag | string | null | | sendEmailNotifications | boolean | @@ -3165,7 +3165,7 @@ _Other possible types: text/json, text/plain_ ### Release | Name | Type | -| -- | -- | +| --- | --- | | category | [Category](#category) | | categoryId | string | null | | countries | Array<[ReleaseCountry](#releasecountry)> | @@ -3186,7 +3186,7 @@ _Other possible types: text/json, text/plain_ ### ReleaseCountry | Name | Type | -| -- | -- | +| --- | --- | | country | [Country](#country) | | countryId | string | null | | release | [Release](#release) | @@ -3197,7 +3197,7 @@ _Other possible types: text/json, text/plain_ ### ReleaseHistory | Name | Type | -| -- | -- | +| --- | --- | | data | string | null | | description | string | | id | string(uuid) | @@ -3211,7 +3211,7 @@ _Other possible types: text/json, text/plain_ ### ReleaseNode | Name | Type | -| -- | -- | +| --- | --- | | id | string(uuid) | | node | [NodeInfo](#nodeinfo) | | nodeId | string(uuid) | @@ -3223,7 +3223,7 @@ _Other possible types: text/json, text/plain_ ### ReleaseNodeDownload | Name | Type | -| -- | -- | +| --- | --- | | accessGrantedByOrganizationId | string(uuid) | null | | id | string(uuid) | | node | [NodeInfo](#nodeinfo) | @@ -3239,7 +3239,7 @@ _Other possible types: text/json, text/plain_ ### ReleaseNodeDownloadPaginatedSet | Name | Type | -| -- | -- | +| --- | --- | | items | Array<[ReleaseNodeDownload](#releasenodedownload)> | | total | integer(int64) | @@ -3248,7 +3248,7 @@ _Other possible types: text/json, text/plain_ ### ReleaseOrganization | Name | Type | -| -- | -- | +| --- | --- | | displayName | string | null | | organizationId | string(uuid) | | release | [Release](#release) | @@ -3259,7 +3259,7 @@ _Other possible types: text/json, text/plain_ ### ReleasePaginatedSet | Name | Type | -| -- | -- | +| --- | --- | | items | Array<[Release](#release)> | | total | integer(int64) | @@ -3268,7 +3268,7 @@ _Other possible types: text/json, text/plain_ ### UpdateReleaseInput | Name | Type | -| -- | -- | +| --- | --- | | categoryId | string | | countries | Array<string> | | description | string | null | @@ -3418,7 +3418,7 @@ This section describes common parameters that are reused across operations. ### PageNumber | Name | In | Type | Default | Nullable | Description | -| ---- | -- | ---- | ------- | -------- | ----------- | +| ---- | --- | ---- | ------- | -------- | ----------- | ## Security schemes diff --git a/tests/serverfixtures.py b/tests/serverfixtures.py index d14bbbf..c70998f 100644 --- a/tests/serverfixtures.py +++ b/tests/serverfixtures.py @@ -1,4 +1,4 @@ -import os +import socket from multiprocessing import Process from time import sleep @@ -16,18 +16,23 @@ def start_server(): app.run(host="127.0.0.1", port=44777) -def get_sleep_time(): - # when starting a server process, - # a longer sleep time is necessary on Windows - if os.name == "nt": - return 1.5 - return 0.5 +def _wait_for_server(host, port, timeout=10.0): + import time + + deadline = time.monotonic() + timeout + while time.monotonic() < deadline: + try: + with socket.create_connection((host, port), timeout=0.1): + return + except OSError: + time.sleep(0.05) + raise RuntimeError(f"Server on {host}:{port} did not start within {timeout}s") def _start_server_process(target): server_process = Process(target=target) server_process.start() - sleep(get_sleep_time()) + _wait_for_server("127.0.0.1", SERVER_PORT) if not server_process.is_alive(): raise TypeError("The server process did not start!")