Sourcery
Sourcery copied to clipboard
Documentation for typealiases doesn't work
Trying to use the nice documentation on type aliases doesn't work:
Stencil:
{% macro generateDocumentation variable %}{% for doc in variable.documentation %}
/// {{ doc }}{% endfor %}
{% endmacro %}
//
// Typealiases
//
{% for type in types.typealiases %}
{% call generateDocumentation type %}
public typealias {{ type.name }} = {{ type.typeName }}
{% endfor %}
//
// Enumerations
//
{% for type in types.implementing.DataModelEnumeration %}
{% call generateDocumentation type %}
public enum {{ type.name }} {
{% for enum in type.cases %}
{% call generateDocumentation enum %}
case {{ enum.name }}
{% endfor %}
}
{% endfor %}
Generated code is:
public typealias SettlementPrice = Double
public typealias ShortName = String
public typealias Turnover = Double
public typealias TurnoverVolume = Double
public typealias Volume = Double
//
// Enumerations
//
/// Documentation for capacity line 1
/// Documentation for capacity line 2
public enum Capacity {
/// Documentation for principle
case principle
/// Documentation for agency
case agency
/// Documentation for riskless
case riskless
}
All the typealises should also have single documentation lines attached, but seems to return empty.
The original source is appropriately documented in both cases:
/// Definition of this field type
public typealias SettlementPrice = Double
/// Definition of this field type
public typealias PreviousSettlementPrice = Double
/// Definition of this field type
public typealias Turnover = Double
/// Definition of this field type
public typealias TurnoverVolume = Double
and
/// Documentation for capacity line 1
/// Documentation for capacity line 2
public enum Capacity: Int, CaseIterable, DataModelEnumeration {
/// Documentation for principle
case principle
/// Documentation for agency
case agency
/// Documentation for riskless
case riskless
}
respectively and they use the same macro defined above, so it seems the typealias simply doesn't have 'documentation' provided.
Hello, @krzysztofzablocki ! Just curious is it any updates on this issue? I'm using Sourcery a lot for autogeneration of public API and all typealiases now miss documentation, which is not great! That will be amazing to have this fixed!
hey, @mr-swifter I can take a look at this after the upcoming updates to https://swiftystack.com since that's my 100% focus atm and don't really have any free time until it's out since it's I'm adding a lot of content, but if you wanted to look at it yourself I'd always accept PR, there is a ton of tests so if you added some it would make working on this relatively straighforward
👋🏻 Thanks for reporting,
PR #1289 resolves this