-
Notifications
You must be signed in to change notification settings - Fork 35
Open
Labels
enhancementNew feature or requestNew feature or requestsubject: code generationThis issue is about code generationThis issue is about code generationsubject: model validationThis issue is about validation of Rosetta models, such as the type systemThis issue is about validation of Rosetta models, such as the type systemsubject: syntaxThis issue is about the syntax of RosettaThis issue is about the syntax of Rosetta
Description
See parent issue: #1077
When extending the input schema, a modeller may require to access additional information in an overridden function which did not exist in the original translation. An example: suppose we have an existing translation from Document.
type Document:
tradeInformation TradeInformation (1..1)
func MapDocument:
inputs:
document Document (1..1)
output:
result Foo (1..1)
set result:
MapTradeInformation(document -> tradeInformation)We decide to extend TradeInformation with a default currency.
type ExtendedTradeInformation extends TradeInformation:
defaultCurrency CurrencyCode (1..1)Now, if we want to access this property when extending the translation, we need a way to assert that the tradeInformation present in the passed document is indeed of type ExtendedTradeInformation. For this we introduce a new operation, as <type>, which allows us to access extended attributes:
(tradeInformation as ExtendedTradeInformation) -> defaultCurrencyIn object oriented languages, this is often referred to as downcasting. Invalid casts result in empty.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestsubject: code generationThis issue is about code generationThis issue is about code generationsubject: model validationThis issue is about validation of Rosetta models, such as the type systemThis issue is about validation of Rosetta models, such as the type systemsubject: syntaxThis issue is about the syntax of RosettaThis issue is about the syntax of Rosetta