From 0cb372c17a0d932ff2440fe1be9e400d2c8feb18 Mon Sep 17 00:00:00 2001 From: Traxmaxx <320272+Traxmaxx@users.noreply.github.com> Date: Sun, 14 Sep 2025 16:27:16 +0200 Subject: [PATCH 1/4] fix: Use Record instead of {} notation when no properties are found --- api_deploy/processors/templates/typescript.object.jinja2 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/api_deploy/processors/templates/typescript.object.jinja2 b/api_deploy/processors/templates/typescript.object.jinja2 index f31cd0f..123a902 100644 --- a/api_deploy/processors/templates/typescript.object.jinja2 +++ b/api_deploy/processors/templates/typescript.object.jinja2 @@ -1,3 +1,4 @@ +{%- if model.properties -%} { {%- for property in model.properties %} /** @@ -35,3 +36,6 @@ {%- endfor %} } +{%- else -%} +Record +{%- endif -%} \ No newline at end of file From 6b6607e6f04347d61776247d14b88f771f0002bc Mon Sep 17 00:00:00 2001 From: Traxmaxx <320272+Traxmaxx@users.noreply.github.com> Date: Mon, 15 Sep 2025 14:46:25 +0200 Subject: [PATCH 2/4] fix: add test-case for Record notation and fix pattern expectation --- tests/openapi/external_ref_target.yml | 12 ++++++------ tests/openapi/one_of_source.yml | 7 +++++++ tests/openapi/one_of_target.yml | 11 ++++++++--- 3 files changed, 21 insertions(+), 9 deletions(-) diff --git a/tests/openapi/external_ref_target.yml b/tests/openapi/external_ref_target.yml index 39306fd..41193fc 100644 --- a/tests/openapi/external_ref_target.yml +++ b/tests/openapi/external_ref_target.yml @@ -740,7 +740,7 @@ components: readOnly: true urn: type: string - pattern: ^urn:[\w-]+:[\w.-]*:[\w.-]*:[\w-]+\/[\w:-]+$ + pattern: ^urn:[\w-]+:[\w.-]*:[\w.-]*:[\w-]+\/[^\/]+$ description: Uniform Resource Name example: urn:pm:service::foobar/d9a6fc2e-a4b3-4fba-9f20-c5bd2fdb5071 tenant: @@ -762,7 +762,7 @@ components: format: date-time createdBy: type: string - pattern: ^urn:[\w-]+:[\w.-]*:[\w.-]*:[\w-]+\/[\w:-]+$ + pattern: ^urn:[\w-]+:[\w.-]*:[\w.-]*:[\w-]+\/[^\/]+$ description: Uniform Resource Name example: urn:pm:service::foobar/d9a6fc2e-a4b3-4fba-9f20-c5bd2fdb5071 modifiedAt: @@ -771,7 +771,7 @@ components: nullable: true modifiedBy: type: string - pattern: ^urn:[\w-]+:[\w.-]*:[\w.-]*:[\w-]+\/[\w:-]+$ + pattern: ^urn:[\w-]+:[\w.-]*:[\w.-]*:[\w-]+\/[^\/]+$ description: Uniform Resource Name example: urn:pm:service::foobar/d9a6fc2e-a4b3-4fba-9f20-c5bd2fdb5071 nullable: true @@ -795,7 +795,7 @@ components: readOnly: true urn: type: string - pattern: ^urn:[\w-]+:[\w.-]*:[\w.-]*:[\w-]+\/[\w:-]+$ + pattern: ^urn:[\w-]+:[\w.-]*:[\w.-]*:[\w-]+\/[^\/]+$ description: Uniform Resource Name example: urn:pm:service::foobar/d9a6fc2e-a4b3-4fba-9f20-c5bd2fdb5071 tenant: @@ -817,7 +817,7 @@ components: format: date-time createdBy: type: string - pattern: ^urn:[\w-]+:[\w.-]*:[\w.-]*:[\w-]+\/[\w:-]+$ + pattern: ^urn:[\w-]+:[\w.-]*:[\w.-]*:[\w-]+\/[^\/]+$ description: Uniform Resource Name example: urn:pm:service::foobar/d9a6fc2e-a4b3-4fba-9f20-c5bd2fdb5071 modifiedAt: @@ -826,7 +826,7 @@ components: nullable: true modifiedBy: type: string - pattern: ^urn:[\w-]+:[\w.-]*:[\w.-]*:[\w-]+\/[\w:-]+$ + pattern: ^urn:[\w-]+:[\w.-]*:[\w.-]*:[\w-]+\/[^\/]+$ description: Uniform Resource Name example: urn:pm:service::foobar/d9a6fc2e-a4b3-4fba-9f20-c5bd2fdb5071 nullable: true diff --git a/tests/openapi/one_of_source.yml b/tests/openapi/one_of_source.yml index 76ce833..c10a815 100644 --- a/tests/openapi/one_of_source.yml +++ b/tests/openapi/one_of_source.yml @@ -70,6 +70,11 @@ components: - UserCreated - ProjectCreated + MessageList: + type: array + items: + type: object + additionalProperties: true UserCreated: allOf: @@ -98,6 +103,7 @@ components: type: string format: datetime + responses: CreateMessage: description: Message @@ -107,6 +113,7 @@ components: oneOf: - $ref: '#/components/schemas/UserCreated' - $ref: '#/components/schemas/ProjectCreated' + - $ref: '#/components/schemas/MessageList' x-amazon-apigateway-request-validators: all: diff --git a/tests/openapi/one_of_target.yml b/tests/openapi/one_of_target.yml index 97b9fcd..3bb3d43 100644 --- a/tests/openapi/one_of_target.yml +++ b/tests/openapi/one_of_target.yml @@ -41,6 +41,7 @@ paths: oneOf: - $ref: '#/components/schemas/UserCreated' - $ref: '#/components/schemas/ProjectCreated' + - $ref: '#/components/schemas/MessageList' headers: Access-Control-Allow-Origin: schema: @@ -361,7 +362,7 @@ components: items: description: Uniform Resource Name example: urn:pm:service::foobar/d9a6fc2e-a4b3-4fba-9f20-c5bd2fdb5071 - pattern: ^urn:[\w-]+:[\w.-]*:[\w.-]*:[\w-]+\/[\w:-]+$ + pattern: ^urn:[\w-]+:[\w.-]*:[\w.-]*:[\w-]+\/[^\/]+$ type: string subject: @@ -389,7 +390,11 @@ components: - subject - message - parameters - + MessageList: + items: + additionalProperties: true + type: object + type: array ProjectCreated: type: object additionalProperties: false @@ -404,7 +409,7 @@ components: items: description: Uniform Resource Name example: urn:pm:service::foobar/d9a6fc2e-a4b3-4fba-9f20-c5bd2fdb5071 - pattern: ^urn:[\w-]+:[\w.-]*:[\w.-]*:[\w-]+\/[\w:-]+$ + pattern: ^urn:[\w-]+:[\w.-]*:[\w.-]*:[\w-]+\/[^\/]+$ type: string subject: From 6e2c6881d672dd721163909e323210804cfbeba4 Mon Sep 17 00:00:00 2001 From: Traxmaxx <320272+Traxmaxx@users.noreply.github.com> Date: Mon, 15 Sep 2025 15:35:37 +0200 Subject: [PATCH 3/4] fix: formatting --- tests/openapi/one_of_target.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/openapi/one_of_target.yml b/tests/openapi/one_of_target.yml index 3bb3d43..2aeb8e7 100644 --- a/tests/openapi/one_of_target.yml +++ b/tests/openapi/one_of_target.yml @@ -390,6 +390,7 @@ components: - subject - message - parameters + MessageList: items: additionalProperties: true From ed09f9e90d752e984bc7434b191a4d5f28a7b301 Mon Sep 17 00:00:00 2001 From: Traxmaxx <320272+Traxmaxx@users.noreply.github.com> Date: Mon, 15 Sep 2025 20:18:48 +0200 Subject: [PATCH 4/4] fix: insert new line at end of file --- api_deploy/processors/templates/typescript.object.jinja2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api_deploy/processors/templates/typescript.object.jinja2 b/api_deploy/processors/templates/typescript.object.jinja2 index 123a902..deae8a8 100644 --- a/api_deploy/processors/templates/typescript.object.jinja2 +++ b/api_deploy/processors/templates/typescript.object.jinja2 @@ -38,4 +38,4 @@ } {%- else -%} Record -{%- endif -%} \ No newline at end of file +{%- endif -%}