From 1ffff4411f59c8cbdaa96e80b17630f2a5ecba55 Mon Sep 17 00:00:00 2001 From: dankinsoid <30962149+dankinsoid@users.noreply.github.com> Date: Tue, 2 Apr 2024 19:22:33 +0300 Subject: [PATCH] 1.2.3 --- README.md | 2 +- SwagGen_Template/Includes/Model.stencil | 2 +- SwagGen_Template/template.yml | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index b56dd5a..c520f17 100644 --- a/README.md +++ b/README.md @@ -324,7 +324,7 @@ import PackageDescription let package = Package( name: "SomeProject", dependencies: [ - .package(url: "https://github.com/dankinsoid/swift-api-client.git", from: "1.2.2") + .package(url: "https://github.com/dankinsoid/swift-api-client.git", from: "1.2.3") ], targets: [ .target( diff --git a/SwagGen_Template/Includes/Model.stencil b/SwagGen_Template/Includes/Model.stencil index af8c8d6..643f8d4 100644 --- a/SwagGen_Template/Includes/Model.stencil +++ b/SwagGen_Template/Includes/Model.stencil @@ -1,4 +1,4 @@ -{% macro propertyType property %}{% if property.type == "DateTime" or property.type == "DateDay" %}Date{% else %}{% if property.raw.format == "timestamp" %}Date{% else %}{{ property.type }}{% endif %}{% endif %}{% if property.optional or property.raw.nullable %}?{% endif %}{% endmacro %} +{% macro propertyType property %}{% if options.customSchemes[property.raw.format] %}{{ options.customSchemes[property.raw.format] }}{% elif property.type == "DateTime" or property.type == "DateDay" or property.raw.format == "timestamp" %}Date{% else %}{{ property.type }}{% endif %}{% if property.optional or property.raw.nullable %}?{% endif %}{% endmacro %} {% macro propertyName property %}{% if property.value|hasPrefix:"_" %}_{{ property.name }}{% else %}{{ property.name }}{% endif %}{% endmacro %} {% if options.excludeTypes[type] == true %} diff --git a/SwagGen_Template/template.yml b/SwagGen_Template/template.yml index 0dcde2b..6458c33 100644 --- a/SwagGen_Template/template.yml +++ b/SwagGen_Template/template.yml @@ -16,6 +16,7 @@ options: groupingType: tag # how to group requests, can be path, tag or none excrsionCheck: false excludeTypes: {} # whether to exclude types from the autogenerated models, example: { Color: true } + customSchemes: {} # custom schemas for types, example: { "hex-color": "Color" } excludeHeaders: {} # whether to exclude headers from the autogenerated requests, example: { ContentType: true } dependencies: - name: SwiftAPIClient