fix(revit): publish id instead of name for type id (#806)

* fix: explicit check for "Type ID" and subsequent send of id

* fix: internal definition name

* docs: some comments

* refactor: internal name check in ParseParametersSet not GetValue

* fix: ToString for id return

---------

Co-authored-by: Claire Kuang <kuang.claire@gmail.com>
This commit is contained in:
Björn Steinhagen
2025-05-08 21:04:35 +02:00
committed by GitHub
parent d31a48c27a
commit 71eeb1bcef
@@ -125,13 +125,18 @@ public class ParameterExtractor
var (internalDefinitionName, humanReadableName, groupName, units) =
_parameterDefinitionHandler.HandleDefinition(parameter);
// NOTE: ids don't really have much meaning; if we discover the opposite, we can bring them back. See [CNX-556: All ID Parameters are send as Name](https://linear.app/speckle/issue/CNX-556/all-id-parameters-are-send-as-name)
// NOTE: general assumption is that ids don't really have much meaning. See [CNX-556: All ID Parameters are send as Name](https://linear.app/speckle/issue/CNX-556/all-id-parameters-are-send-as-name)
// NOTE: subsequent request resulting in certain IDs being brought back. See [CNX-1125](https://linear.app/speckle/issue/CNX-1125/publish-type-id-instead-of-name) in GetValue() method
// "Type ID" (associated with "SYMBOL_ID_PARAM") won't evaluate to true here which is intentional
if (internalDefinitionName.EndsWith("_ID") || internalDefinitionName.EndsWith("_PARAM_ID"))
{
continue;
}
var value = GetValue(parameter);
// NOTE: excepted behaviour is to use GetValue BUT if we have "SYMBOL_ID_PARAM", we just want id
// see above comment and linked linear ticket / issue.
object? value =
internalDefinitionName == "SYMBOL_ID_PARAM" ? parameter.AsElementId().ToString() : GetValue(parameter);
var isNullOrEmpty = value == null || (value is string s && string.IsNullOrEmpty(s));