Skip to content

Commit

Permalink
добавил eventEdition для event-а, чтобы отличать приложения
Browse files Browse the repository at this point in the history
  • Loading branch information
i.mnazhdin committed Feb 16, 2024
1 parent 637044e commit 87c5a19
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ final class DefaultEventGenerator: EventGenerator {
parameters.render.internalTemplate,
to: parameters.render.destination.appending(path: "\(filename)Event.swift"),
context: InternalEventContext(
edition: event.edition,
deprecated: event.deprecated ?? false,
name: event.name,
description: event.description,
Expand Down Expand Up @@ -135,6 +136,7 @@ final class DefaultEventGenerator: EventGenerator {
parameters.render.externalTemplate,
to: parameters.render.destination.appending(path: "\(filename)ExternalEvent.swift"),
context: ExternalEventContext(
edition: event.edition,
deprecated: event.deprecated ?? false,
name: event.name,
description: event.description,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ struct ExternalEventContext: Encodable {

// MARK: - Instance Properties

let edition: [EventEdition]?
let deprecated: Bool
let name: String
let description: String?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ struct InternalEventContext: Encodable {

// MARK: - Instance Properties

let edition: [EventEdition]?
let deprecated: Bool
let name: String
let description: String?
Expand Down
2 changes: 1 addition & 1 deletion Sources/AnalyticsGen/Models/Event/Event.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ struct Event: Decodable {
// MARK: - Instance Properties

let application: EventApplication
let edition: [EventEdition]
let edition: [EventEdition]?
let deprecated: Bool?
let category: String
let description: String?
Expand Down
2 changes: 1 addition & 1 deletion Sources/AnalyticsGen/Models/Event/EventEdition.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import Foundation

enum EventEdition: String, Decodable {
enum EventEdition: String, Codable {

// MARK: - Enumeration Cases

Expand Down
5 changes: 5 additions & 0 deletions Templates/ExternalEvent.stencil
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import Analytics
- **Описание**: {{ description }}
{% endif %}
*/

{{ accessModifier }} struct {{ structName }}: ExternalEvent {

{% if label.oneOf %}
Expand All @@ -31,6 +32,10 @@ import Analytics
}
{% endif %}

{% if edition %}
{{ accessModifier }} let edition: [ExternalEventUserType] = {{ edition }}
{% endif %}

{% if category.oneOf %}
{{ accessModifier }} enum Category: String {
{% for oneOf in category.oneOf %}
Expand Down

0 comments on commit 87c5a19

Please sign in to comment.